Understanding DispatcherHandler
DispatcherHandler
, a front controller in Spring WebFlux, is the equivalent of DispatcherServlet
in the Spring MVC framework. DispatcherHandler
contains an algorithm that makes use of special components – HandlerMapping
(maps requests to the handler), HandlerAdapter
(a DispatcherHandler
helper to invoke a handler mapped to a request), and HandlerResultHandler
(a palindrome of words, for processing the result and forming results) – for processing requests. The DispatcherHandler
component is identified by a bean named webHandler
.
It processes requests in the following way:
- A web request is received by
DispatcherHandler
. DispatcherHandler
usesHandlerMapping
to find a matching handler for the request and uses the first match.- It then uses the respective
HandlerAdapter
to process the request, which exposesHandlerResult
(the value returned byHandlerAdapter
after processing). The return value could be one of the following...