Class WebFluxConfigurationSupport
java.lang.Object
org.springframework.web.reactive.config.WebFluxConfigurationSupport
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
DelegatingWebFluxConfiguration
public class WebFluxConfigurationSupport
extends Object
implements org.springframework.context.ApplicationContextAware
The main class for Spring WebFlux configuration.
Import directly or extend and override protected methods to customize.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCorsMappings(CorsRegistry registry) Override this method to configure cross-origin requests processing.protected voidaddFormatters(org.springframework.format.FormatterRegistry registry) Override this method to add customConverterand/orFormatterdelegates to the commonFormattingConversionService.protected voidaddResourceHandlers(ResourceHandlerRegistry registry) Override this method to add resource handlers for serving static resources.protected voidconfigureArgumentResolvers(ArgumentResolverConfigurer configurer) Configure resolvers for custom controller method arguments.protected voidOverride this method to configure blocking execution.protected voidOverride to configure how the requested content type is resolved.protected voidconfigureErrorResponseInterceptors(List<org.springframework.web.ErrorResponse.Interceptor> interceptors) Override this method for control over theErrorResponse.Interceptor's to apply in result handling when rendering error responses.protected voidconfigureHttpMessageCodecs(org.springframework.http.codec.ServerCodecConfigurer configurer) Override to configure the HTTP message readers and writers to use.voidconfigurePathMatching(PathMatchConfigurer configurer) Override to configure path matching options.protected voidconfigureViewResolvers(ViewResolverRegistry registry) Configure view resolution for supporting template engines.protected org.springframework.web.server.i18n.LocaleContextResolverOverride to plug a subclass ofLocaleContextResolver.protected RequestMappingHandlerAdapterOverride to plug a subclass ofRequestMappingHandlerAdapter.protected RequestMappingHandlerMappingOverride to plug a subclass ofRequestMappingHandlerMapping.protected RouterFunctionMappingOverride to plug a subclass ofRouterFunctionMapping.final org.springframework.context.ApplicationContextprotected final BlockingExecutionConfigurerCallback to build and cache theBlockingExecutionConfigurer.protected org.springframework.web.bind.support.ConfigurableWebBindingInitializergetConfigurableWebBindingInitializer(org.springframework.format.support.FormattingConversionService webFluxConversionService, org.springframework.validation.Validator webFluxValidator) Return theConfigurableWebBindingInitializerto use for initializing allWebDataBinderinstances.Callback for building the global CORS configuration.protected final List<org.springframework.web.ErrorResponse.Interceptor>Provide access to the list ofErrorResponse.Interceptor's to apply in result handlers when rendering error responses.protected org.springframework.validation.MessageCodesResolverOverride this method to provide a customMessageCodesResolver.protected final PathMatchConfigurerCallback for building thePathMatchConfigurer.protected org.springframework.validation.ValidatorOverride this method to provide a customValidator.protected final ViewResolverRegistryCallback for building theViewResolverRegistry.protected WebSocketServiceorg.springframework.web.server.i18n.LocaleContextResolverrequestMappingHandlerAdapter(org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, org.springframework.format.support.FormattingConversionService conversionService, RequestedContentTypeResolver contentTypeResolver, org.springframework.validation.Validator validator) requestMappingHandlerMapping(RequestedContentTypeResolver contentTypeResolver) resourceHandlerMapping(ResourceUrlProvider resourceUrlProvider) Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers.responseBodyResultHandler(org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, RequestedContentTypeResolver contentTypeResolver) responseEntityResultHandler(org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, RequestedContentTypeResolver contentTypeResolver) org.springframework.web.server.WebExceptionHandlerrouterFunctionMapping(org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer) org.springframework.http.codec.ServerCodecConfigurerReturn the configurer for HTTP message readers and writers.serverResponseResultHandler(org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) viewResolutionResultHandler(org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, RequestedContentTypeResolver contentTypeResolver) org.springframework.core.ReactiveAdapterRegistryReturn aReactiveAdapterRegistryto adapting reactive types.org.springframework.format.support.FormattingConversionServiceReturn aFormattingConversionServicefor use with annotated controllers.org.springframework.validation.ValidatorReturn a globalValidatorinstance for example for validating@RequestBodymethod arguments.
-
Constructor Details
-
WebFluxConfigurationSupport
public WebFluxConfigurationSupport()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(@Nullable org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getApplicationContext
@Nullable public final org.springframework.context.ApplicationContext getApplicationContext() -
webHandler
-
responseStatusExceptionHandler
@Bean @Order(0) public org.springframework.web.server.WebExceptionHandler 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(org.springframework.http.codec.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") org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver, @Qualifier("webFluxValidator") org.springframework.validation.Validator validator) -
createRequestMappingHandlerAdapter
Override to plug a subclass ofRequestMappingHandlerAdapter. -
configureArgumentResolvers
Configure resolvers for custom controller method arguments. -
serverCodecConfigurer
@Bean public org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer()Return the configurer for HTTP message readers and writers.Use
configureHttpMessageCodecs(ServerCodecConfigurer)to configure the readers and writers. -
createLocaleContextResolver
protected org.springframework.web.server.i18n.LocaleContextResolver createLocaleContextResolver()Override to plug a subclass ofLocaleContextResolver. -
localeContextResolver
@Bean public org.springframework.web.server.i18n.LocaleContextResolver localeContextResolver() -
configureHttpMessageCodecs
protected void configureHttpMessageCodecs(org.springframework.http.codec.ServerCodecConfigurer configurer) Override to configure the HTTP message readers and writers to use. -
getConfigurableWebBindingInitializer
protected org.springframework.web.bind.support.ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(org.springframework.format.support.FormattingConversionService webFluxConversionService, org.springframework.validation.Validator webFluxValidator) Return theConfigurableWebBindingInitializerto use for initializing allWebDataBinderinstances. -
webFluxConversionService
@Bean public org.springframework.format.support.FormattingConversionService webFluxConversionService()Return aFormattingConversionServicefor use with annotated controllers.See
addFormatters(org.springframework.format.FormatterRegistry)as an alternative to overriding this method. -
addFormatters
protected void addFormatters(org.springframework.format.FormatterRegistry registry) Override this method to add customConverterand/orFormatterdelegates to the commonFormattingConversionService.- See Also:
-
webFluxAdapterRegistry
@Bean public org.springframework.core.ReactiveAdapterRegistry webFluxAdapterRegistry()Return aReactiveAdapterRegistryto adapting reactive types. -
webFluxValidator
@Bean public org.springframework.validation.Validator webFluxValidator()Return a globalValidatorinstance for example for validating@RequestBodymethod arguments.Delegates to
getValidator()first. If that returnsnullchecks the classpath for the presence of a JSR-303 implementations before creating aOptionalValidatorFactoryBean. If a JSR-303 implementation is not available, a "no-op"Validatoris returned. -
getValidator
@Nullable protected org.springframework.validation.Validator getValidator()Override this method to provide a customValidator. -
getMessageCodesResolver
@Nullable protected org.springframework.validation.MessageCodesResolver 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") org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
responseBodyResultHandler
@Bean public ResponseBodyResultHandler responseBodyResultHandler(@Qualifier("webFluxAdapterRegistry") org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
viewResolutionResultHandler
@Bean public ViewResolutionResultHandler viewResolutionResultHandler(@Qualifier("webFluxAdapterRegistry") org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, @Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) -
serverResponseResultHandler
@Bean public ServerResponseResultHandler serverResponseResultHandler(org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer) -
getErrorResponseInterceptors
protected final List<org.springframework.web.ErrorResponse.Interceptor> 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
protected void configureErrorResponseInterceptors(List<org.springframework.web.ErrorResponse.Interceptor> interceptors) 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:
-