public class DispatcherHandler extends Object implements WebHandler, PreFlightRequestHandler, ApplicationContextAware
DispatcherHandler discovers the delegate components it needs from
 Spring configuration. It detects the following in the application context:
 
HandlerMapping -- map requests to handler objects
 HandlerAdapter -- for using any handler interface
 HandlerResultHandler -- process handler return values
 DispatcherHandler is also designed to be a Spring bean itself and
 implements ApplicationContextAware for access to the context it runs
 in. If DispatcherHandler is declared as a bean with the name
 "webHandler", it is discovered by
 WebHttpHandlerBuilder.applicationContext(ApplicationContext) which
 puts together a processing chain together with WebFilter,
 WebExceptionHandler and others.
 
A DispatcherHandler bean declaration is included in
 @EnableWebFlux
 configuration.
WebHttpHandlerBuilder.applicationContext(ApplicationContext)| Constructor and Description | 
|---|
| DispatcherHandler()Create a new  DispatcherHandlerwhich needs to be configured with
 anApplicationContextthroughsetApplicationContext(org.springframework.context.ApplicationContext). | 
| DispatcherHandler(ApplicationContext applicationContext)Create a new  DispatcherHandlerfor the givenApplicationContext. | 
| Modifier and Type | Method and Description | 
|---|---|
| List<HandlerMapping> | getHandlerMappings() | 
| reactor.core.publisher.Mono<Void> | handle(ServerWebExchange exchange)Handle the web server exchange. | 
| reactor.core.publisher.Mono<Void> | handlePreFlight(ServerWebExchange exchange)Handle a pre-flight request by finding and applying the CORS configuration
 that matches the expected actual request. | 
| protected void | initStrategies(ApplicationContext context) | 
| void | setApplicationContext(ApplicationContext applicationContext)Set the ApplicationContext that this object runs in. | 
public DispatcherHandler()
DispatcherHandler which needs to be configured with
 an ApplicationContext through setApplicationContext(org.springframework.context.ApplicationContext).public DispatcherHandler(ApplicationContext applicationContext)
DispatcherHandler for the given ApplicationContext.applicationContext - the application context to find the handler beans in@Nullable public final List<HandlerMapping> getHandlerMappings()
HandlerMapping beans detected by type in the
 injected context and also
 sorted.
 Note: This method may return null if invoked
 prior to setApplicationContext(ApplicationContext).
nullpublic void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAwareInvoked after population of normal bean properties but before an init callback such
 as InitializingBean.afterPropertiesSet()
 or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),
 ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) and
 MessageSourceAware, if applicable.
setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext object to be used by this objectBeanInitializationExceptionprotected void initStrategies(ApplicationContext context)
public reactor.core.publisher.Mono<Void> handle(ServerWebExchange exchange)
WebHandlerhandle in interface WebHandlerexchange - the current server exchangeMono<Void> to indicate when request handling is completepublic reactor.core.publisher.Mono<Void> handlePreFlight(ServerWebExchange exchange)
PreFlightRequestHandlerHttpStatus.FORBIDDEN.handlePreFlight in interface PreFlightRequestHandlerexchange - the exchange for the request