Refine @EnableWebFlux docs for functional endpoints
@EnableWebFlux bootstraps both annotated controllers and functional endpoints, so we need to be more explicit about which parts of the configuration apply to which. Issue: SPR-16360
This commit is contained in:
@@ -205,20 +205,21 @@ The returned `HttpHandler` can then be used with a number of servers adapters by
|
||||
A more advanced option is to run with a
|
||||
<<web-reactive.adoc#webflux-dispatcher-handler,DispatcherHandler>>-based setup through the
|
||||
<<web-reactive.adoc#webflux-config>> which uses Spring configuration to declare the
|
||||
components process requests. The WebFlux Java config declares the following components
|
||||
related to functional endpoints:
|
||||
components quired to process requests. The WebFlux Java config declares the following
|
||||
infrastructure components to support functional endpoints:
|
||||
|
||||
* `RouterFunctionMapping` -- this detects one or more `RouterFunction<?>` beans in the
|
||||
Spring configuration, combines them via `RouterFunction.andOther`, and routes requests to
|
||||
the resulting, composed `RouterFunction`.
|
||||
* `HandlerFunctionAdapter` -- simple adapter to invoke a `HandlerFunction` selected to
|
||||
handle a request.
|
||||
* `ServerResponseResultHandler` -- invokes the `writeTo` method of the `ServerResponse`
|
||||
returned by the `HandlerFunction`.
|
||||
* `RouterFunctionMapping` -- detects one or more `RouterFunction<?>` beans in the Spring
|
||||
configuration, combines them via `RouterFunction.andOther`, and routes requests to the
|
||||
resulting composed `RouterFunction`.
|
||||
* `HandlerFunctionAdapter` -- simple adapter that allows the `DispatcherHandler` to invoke
|
||||
a `HandlerFunction` that was mapped to a request.
|
||||
* `ServerResponseResultHandler` -- handles the result from the invocation of a
|
||||
`HandlerFunction` by invoking the `writeTo` method of the `ServerResponse`.
|
||||
|
||||
The above allows functional endpoints to fit within the `DispatcherHandler` request
|
||||
processing lifecycle, and potentially to run side by side with annotated controllers, if
|
||||
any are declared. This is also the mechanism used in the Spring Boot WebFlux starter.
|
||||
The above components allow functional endpoints to fit within the `DispatcherHandler` request
|
||||
processing lifecycle, and also potentially run side by side with annotated controllers, if
|
||||
any are declared. It is also how functional endpoints are enabled the Spring Boot WebFlux
|
||||
starter.
|
||||
|
||||
Below is example WebFlux Java config (see
|
||||
<<web-reactive.adoc#webflux-dispatcher-handler,DispatcherHandler>> for how to run):
|
||||
|
||||
@@ -1098,13 +1098,16 @@ include::webflux-functional.adoc[leveloffset=+1]
|
||||
== WebFlux Java Config
|
||||
[.small]#<<web.adoc#mvc-config,Same in Spring MVC>>#
|
||||
|
||||
The WebFlux Java config provides default configuration suitable for most applications along
|
||||
with a configuration API to customize it. For more advanced customizations, not available in
|
||||
the configuration API, see <<webflux-config-advanced-java>>.
|
||||
The WebFlux Java config declares components required to process requests with annotated
|
||||
controllers or functional endpoints, and it offers an API to customize the configuration.
|
||||
That means you do not need to understand the underlying beans created by the Java config
|
||||
but, if you want to, it's very easy to see them in `WebFluxConfigurationSupport` or read more
|
||||
what they are in <<webflux-special-bean-types>>.
|
||||
|
||||
For more advanced customizations, not available in the configuration API, it is also
|
||||
possible to gain full control over the configuration through the
|
||||
<<webflux-config-advanced-java>>.
|
||||
|
||||
You do not need to understand the underlying beans created by the Java config, but it's
|
||||
easy to seem them in `WebFluxConfigurationSupport`, and if you want to learn more, see
|
||||
<<webflux-special-bean-types>>.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user