Class WebFluxConfigurationSupport
- All Implemented Interfaces:
Aware
,ApplicationContextAware
- Direct Known Subclasses:
DelegatingWebFluxConfiguration
Import directly or extend and override protected methods to customize.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCorsMappings
(CorsRegistry registry) Override this method to configure cross-origin requests processing.protected void
addFormatters
(FormatterRegistry registry) Override this method to add customConverter
and/orFormatter
delegates to the commonFormattingConversionService
.protected void
addResourceHandlers
(ResourceHandlerRegistry registry) Override this method to add resource handlers for serving static resources.protected void
configureArgumentResolvers
(ArgumentResolverConfigurer configurer) Configure resolvers for custom controller method arguments.protected void
Override this method to configure blocking execution.protected void
Override to configure how the requested content type is resolved.protected void
configureErrorResponseInterceptors
(List<ErrorResponse.Interceptor> interceptors) Override this method for control over theErrorResponse.Interceptor
's to apply in result handling when rendering error responses.protected void
configureHttpMessageCodecs
(ServerCodecConfigurer configurer) Override to configure the HTTP message readers and writers to use.void
configurePathMatching
(PathMatchConfigurer configurer) Override to configure path matching options.protected void
configureViewResolvers
(ViewResolverRegistry registry) Configure view resolution for supporting template engines.protected LocaleContextResolver
Override to plug a subclass ofLocaleContextResolver
.protected RequestMappingHandlerAdapter
Override to plug a subclass ofRequestMappingHandlerAdapter
.protected RequestMappingHandlerMapping
Override to plug a subclass ofRequestMappingHandlerMapping
.protected RouterFunctionMapping
Override to plug a subclass ofRouterFunctionMapping
.final ApplicationContext
protected final BlockingExecutionConfigurer
Callback to build and cache theBlockingExecutionConfigurer
.protected ConfigurableWebBindingInitializer
getConfigurableWebBindingInitializer
(FormattingConversionService webFluxConversionService, Validator webFluxValidator) Return theConfigurableWebBindingInitializer
to use for initializing allWebDataBinder
instances.protected final Map<String,
CorsConfiguration> Callback for building the global CORS configuration.protected final List<ErrorResponse.Interceptor>
Provide access to the list ofErrorResponse.Interceptor
's to apply in result handlers when rendering error responses.protected MessageCodesResolver
Override this method to provide a customMessageCodesResolver
.protected final PathMatchConfigurer
Callback for building thePathMatchConfigurer
.protected Validator
Override this method to provide a customValidator
.protected final ViewResolverRegistry
Callback for building theViewResolverRegistry
.protected WebSocketService
requestMappingHandlerAdapter
(ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, FormattingConversionService conversionService, RequestedContentTypeResolver contentTypeResolver, Validator validator) requestMappingHandlerMapping
(RequestedContentTypeResolver contentTypeResolver) resourceHandlerMapping
(ResourceUrlProvider resourceUrlProvider) Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers.responseBodyResultHandler
(ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, RequestedContentTypeResolver contentTypeResolver) responseEntityResultHandler
(ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, RequestedContentTypeResolver contentTypeResolver) routerFunctionMapping
(ServerCodecConfigurer serverCodecConfigurer) Return the configurer for HTTP message readers and writers.serverResponseResultHandler
(ServerCodecConfigurer serverCodecConfigurer) void
setApplicationContext
(ApplicationContext applicationContext) Set the ApplicationContext that this object runs in.viewResolutionResultHandler
(ReactiveAdapterRegistry reactiveAdapterRegistry, RequestedContentTypeResolver contentTypeResolver) Return aReactiveAdapterRegistry
to adapting reactive types.Return aFormattingConversionService
for use with annotated controllers.Return a globalValidator
instance for example for validating@RequestBody
method arguments.
-
Constructor Details
-
WebFluxConfigurationSupport
public WebFluxConfigurationSupport()
-
-
Method Details
-
setApplicationContext
Description copied from interface:ApplicationContextAware
Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
andMessageSourceAware
, if applicable.- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Parameters:
applicationContext
- the ApplicationContext object to be used by this object- See Also:
-
getApplicationContext
-
webHandler
-
responseStatusExceptionHandler
-
requestMappingHandlerMapping
@Bean public RequestMappingHandlerMapping requestMappingHandlerMapping(@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
createRequestMappingHandlerMapping
Override to plug a subclass ofRequestMappingHandlerMapping
. -
webFluxContentTypeResolver
-
configureContentTypeResolver
Override to configure how the requested content type is resolved. -
getCorsConfigurations
Callback for building the global CORS configuration. This method is final. UseaddCorsMappings(CorsRegistry)
to customize the CORS config. -
addCorsMappings
Override this method to configure cross-origin requests processing.- See Also:
-
getPathMatchConfigurer
Callback for building thePathMatchConfigurer
. This method is final, useconfigurePathMatching(org.springframework.web.reactive.config.PathMatchConfigurer)
to customize path matching. -
configurePathMatching
Override to configure path matching options. -
routerFunctionMapping
@Bean public RouterFunctionMapping routerFunctionMapping(ServerCodecConfigurer serverCodecConfigurer) -
createRouterFunctionMapping
Override to plug a subclass ofRouterFunctionMapping
. -
resourceHandlerMapping
Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers. To configure resource handling, overrideaddResourceHandlers(org.springframework.web.reactive.config.ResourceHandlerRegistry)
. -
resourceUrlProvider
-
addResourceHandlers
Override this method to add resource handlers for serving static resources.- See Also:
-
requestMappingHandlerAdapter
@Bean public RequestMappingHandlerAdapter requestMappingHandlerAdapter(@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxConversionService") FormattingConversionService conversionService, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver, @Qualifier("webFluxValidator") Validator validator) -
createRequestMappingHandlerAdapter
Override to plug a subclass ofRequestMappingHandlerAdapter
. -
configureArgumentResolvers
Configure resolvers for custom controller method arguments. -
serverCodecConfigurer
Return the configurer for HTTP message readers and writers.Use
configureHttpMessageCodecs(ServerCodecConfigurer)
to configure the readers and writers. -
createLocaleContextResolver
Override to plug a subclass ofLocaleContextResolver
. -
localeContextResolver
-
configureHttpMessageCodecs
Override to configure the HTTP message readers and writers to use. -
getConfigurableWebBindingInitializer
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(FormattingConversionService webFluxConversionService, Validator webFluxValidator) Return theConfigurableWebBindingInitializer
to use for initializing allWebDataBinder
instances. -
webFluxConversionService
Return aFormattingConversionService
for use with annotated controllers.See
addFormatters(org.springframework.format.FormatterRegistry)
as an alternative to overriding this method. -
addFormatters
Override this method to add customConverter
and/orFormatter
delegates to the commonFormattingConversionService
.- See Also:
-
webFluxAdapterRegistry
Return aReactiveAdapterRegistry
to adapting reactive types. -
webFluxValidator
Return a globalValidator
instance for example for validating@RequestBody
method arguments.Delegates to
getValidator()
first. If that returnsnull
checks the classpath for the presence of a JSR-303 implementations before creating aOptionalValidatorFactoryBean
. If a JSR-303 implementation is not available, a "no-op"Validator
is returned. -
getValidator
Override this method to provide a customValidator
. -
getMessageCodesResolver
Override this method to provide a customMessageCodesResolver
. -
getBlockingExecutionConfigurer
Callback to build and cache theBlockingExecutionConfigurer
. This method is final, but subclasses can overrideconfigureBlockingExecution(org.springframework.web.reactive.config.BlockingExecutionConfigurer)
.- Since:
- 6.1
-
configureBlockingExecution
Override this method to configure blocking execution.- Since:
- 6.1
-
handlerFunctionAdapter
-
simpleHandlerAdapter
-
webFluxWebSocketHandlerAdapter
-
getWebSocketService
-
responseEntityResultHandler
@Bean public ResponseEntityResultHandler responseEntityResultHandler(@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
responseBodyResultHandler
@Bean public ResponseBodyResultHandler responseBodyResultHandler(@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
viewResolutionResultHandler
@Bean public ViewResolutionResultHandler viewResolutionResultHandler(@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
serverResponseResultHandler
@Bean public ServerResponseResultHandler serverResponseResultHandler(ServerCodecConfigurer serverCodecConfigurer) -
getErrorResponseInterceptors
Provide access to the list ofErrorResponse.Interceptor
's to apply in result handlers when rendering error responses.This method cannot be overridden; use
configureErrorResponseInterceptors(List)
instead.- Since:
- 6.2
-
configureErrorResponseInterceptors
Override this method for control over theErrorResponse.Interceptor
's to apply in result handling when rendering error responses.- Parameters:
interceptors
- the list to add handlers to- Since:
- 6.2
-
getViewResolverRegistry
Callback for building theViewResolverRegistry
. This method is final, useconfigureViewResolvers(org.springframework.web.reactive.config.ViewResolverRegistry)
to customize view resolvers. -
configureViewResolvers
Configure view resolution for supporting template engines.- See Also:
-