diff --git a/src/docs/asciidoc/web/webflux.adoc b/src/docs/asciidoc/web/webflux.adoc index 5f49082d15bbb69c6b6ee3c2f5bad418b3ceb8eb..2164abde7f1694dc877d512ac1232ce98e60ac1e 100644 --- a/src/docs/asciidoc/web/webflux.adoc +++ b/src/docs/asciidoc/web/webflux.adoc @@ -481,7 +481,8 @@ implement one of the framework contracts listed in the table below. Spring WebFlux provides built-in implementations of these contracts but you can also customize, extend, or replace them. -.Special bean types in the ApplicationContext +[[webflux-special-beans-table]] +[cols="1,2", options="header"] |=== | Bean type| Explanation @@ -490,19 +491,43 @@ customize, extend, or replace them. which vary by `HandlerMapping` implementation -- annotated controllers, simple URL pattern mappings, etc. + The main `HandlerMapping` implementations are `RequestMappingHandlerMapping` based on + `@RequestMapping` annotated methods, `RouterFunctionMapping` based on functional + endpoint routes, and `SimpleUrlHandlerMapping` based on explicit registrations of URI + path patterns to handlers. + | HandlerAdapter -| Helps the `DispatcherHandler` to invoke a handler mapped to a request regardless of +| Help the `DispatcherHandler` to invoke a handler mapped to a request regardless of how the handler is actually invoked. For example invoking an annotated controller - requires resolving various annotations. The main purpose of a `HandlerAdapter` is - to shield the `DispatcherHandler` from such details. + requires resolving annotations. The main purpose of a `HandlerAdapter` is to shield the + `DispatcherHandler` from such details. | HandlerResultHandler -| Process the `HandlerResult` returned from a `HandlerAdapter`. +| Process the result from the handler invocation and finalize the response. + + The built-in `HandlerResultHandler` implementations are `ResponseEntityResultHandler` + supporting `ResponseEntity` return values, `ResponseBodyResultHandler` + supporting `@ResponseBody` methods, `ServerResponseResultHandler` + supporting the `ServerResponse` returned from functional endpoints, and + `ViewResolutionResultHandler` supporting rendering with a view and a model. |=== + +[[webflux-framework-config]] +=== Framework Config +[.small]#<># + +The `DispatcherHandler` detects the special beans it needs in the `ApplicationContext`. +Applications can declare the special beans they wish to have. However most applications +will find a better starting point in the WebFlux Java config which provide a higher level +configuration API that in turn make the necessary bean declarations. +See <> for more details. + + + [[webflux-dispatcher-handler-sequence]] -=== Processing sequence +=== Processing [.small]#<># The `DispatcherHandler` processes requests as follows: @@ -574,7 +599,7 @@ rendering). [[webflux-ann-requestmapping]] -=== Mapping Requests +=== Request Mapping [.small]#<># The `@RequestMapping` annotation is used to map requests to controllers methods. It has diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index ca43adea2543cf15081016ac7b3ece8af24fb707..3773a0da52d949878427962dedd43a9fbcdcf9ba 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -218,14 +218,14 @@ customize, extend, or replace them. The mapping is based on some criteria the details of which vary by `HandlerMapping` implementation. - The two main HandlerMapping implementations are `RequestMappingHandlerMapping` which + The two main `HandlerMapping` implementations are `RequestMappingHandlerMapping` which supports `@RequestMapping` annotated methods and `SimpleUrlHandlerMapping` which maintains explicit registrations of URI path patterns to handlers. | HandlerAdapter -| Helps the `DispatcherServlet` to invoke a handler mapped to a request regardless of +| Help the `DispatcherServlet` to invoke a handler mapped to a request regardless of how the handler is actually invoked. For example, invoking an annotated controller - requires resolving various annotations. The main purpose of a `HandlerAdapter` is + requires resolving annotations. The main purpose of a `HandlerAdapter` is to shield the `DispatcherServlet` from such details. | <> @@ -233,15 +233,15 @@ customize, extend, or replace them. views, or other. See <>. | <> -| Resolves logical String-based view names returned from a handler to an actual `View` +| Resolve logical String-based view names returned from a handler to an actual `View` to render to the response with. See <> and <>. | <>, <> -| Resolves the `Locale` a client is using and possibly their time zone, in order to be able +| Resolve the `Locale` a client is using and possibly their time zone, in order to be able to offer internationalized views. See <>. | <> -| Resolves themes your web application can use, for example, to offer personalized layouts. +| Resolve themes your web application can use, for example, to offer personalized layouts. See <>. | <> @@ -249,7 +249,7 @@ customize, extend, or replace them. the help of some multipart parsing library. See <>. | <> -| Stores and retrieves the "input" and the "output" `FlashMap` that can be used to pass +| Store and retrieve the "input" and the "output" `FlashMap` that can be used to pass attributes from one request to another, usually across a redirect. See <>. |=== @@ -257,6 +257,8 @@ customize, extend, or replace them. [[mvc-servlet-config]] === Framework Config +[.small]#<># + For each type of special bean, the `DispatcherServlet` checks for the `WebApplicationContext` first. If there are no matching bean types, it falls back on the default types listed in https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/org/springframework/web/servlet/DispatcherServlet.properties[DispatcherServlet.properties].