Top Description Methods
org.springframework.web.reactive.config

public Interface WebFluxConfigurer

Known Direct Implementers
org.springframework.web.reactive.config.WebFluxConfigurerComposite
Imports
org.springframework.core.convert.converter.Converter, org.springframework.format.Formatter, .FormatterRegistry, org.springframework.http.codec.ServerCodecConfigurer, org.springframework.lang.Nullable, org.springframework.validation.MessageCodesResolver, .Validator, org.springframework.web.cors.CorsConfiguration, org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder, org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer, org.springframework.web.reactive.socket.server.WebSocketService

Defines callback methods to customize the configuration for WebFlux applications enabled via @EnableWebFlux.

@EnableWebFlux-annotated configuration classes may implement this interface to be called back and given a chance to customize the default configuration. Consider implementing this interface and overriding the relevant methods for your needs.

Authors
Brian Clozel, Rossen Stoyanchev
Since
5.0
See Also
WebFluxConfigurationSupport, DelegatingWebFluxConfiguration

Method Summary

Modifier and TypeMethod and Description
public default void
addCorsMappings(CorsRegistry registry)

Configure "global" cross-origin request processing.

public default void
addFormatters(FormatterRegistry registry)

Add custom Converters and Formatters for performing type conversion and formatting of annotated controller method arguments.

public default void
addResourceHandlers(ResourceHandlerRegistry registry)

Add resource handlers for serving static resources.

public default void
configureArgumentResolvers(ArgumentResolverConfigurer
to configurer to use
configurer
)

Configure resolvers for custom @RequestMapping method arguments.

public default void
configureBlockingExecution(BlockingExecutionConfigurer configurer)

Configure settings related to blocking execution in WebFlux.

public default void
configureContentTypeResolver(RequestedContentTypeResolverBuilder
for configuring the resolvers to use
builder
)

Configure how the content type requested for the response is resolved when handling requests with annotated controllers.

public default void
configureHttpMessageCodecs(ServerCodecConfigurer
the configurer to customize readers and writers
configurer
)

Configure the HTTP message readers and writers for reading from the request body and for writing to the response body in annotated controllers and functional endpoints.

public default void
configurePathMatching(PathMatchConfigurer
the PathMatchConfigurer instance
configurer
)

Configure path matching options.

public default void
configureViewResolvers(ViewResolverRegistry registry)

Configure view resolution for rendering responses with a view and a model, where the view is typically an HTML template but could also be based on an HTTP message writer (e.g. JSON, XML).

public default MessageCodesResolver
getMessageCodesResolver()

Provide a custom MessageCodesResolver to use for data binding in annotated controller method arguments instead of the one created by default in org.springframework.validation.DataBinder.

public default Validator
getValidator()

Provide a custom Validator.

public default WebSocketService

Method Detail

addCorsMappingsback to summary
public default void addCorsMappings(CorsRegistry registry)

Configure "global" cross-origin request processing. The configured CORS mappings apply to annotated controllers, functional endpoints, and static resources.

Annotated controllers can further declare more fine-grained config via @CrossOrigin. In such cases "global" CORS configuration declared here is combined with local CORS configuration defined on a controller method.

See Also
CorsRegistry, CorsConfiguration#combine(CorsConfiguration)
addFormattersback to summary
public default void addFormatters(FormatterRegistry registry)

Add custom Converters and Formatters for performing type conversion and formatting of annotated controller method arguments.

addResourceHandlersback to summary
public default void addResourceHandlers(ResourceHandlerRegistry registry)

Add resource handlers for serving static resources.

See Also
ResourceHandlerRegistry
configureArgumentResolversback to summary
public default void configureArgumentResolvers(ArgumentResolverConfigurer configurer)

Configure resolvers for custom @RequestMapping method arguments.

Parameters
configurer:ArgumentResolverConfigurer

to configurer to use

configureBlockingExecutionback to summary
public default void configureBlockingExecution(BlockingExecutionConfigurer configurer)

Configure settings related to blocking execution in WebFlux.

Since
6.1
configureContentTypeResolverback to summary
public default void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder)

Configure how the content type requested for the response is resolved when handling requests with annotated controllers.

Parameters
builder:RequestedContentTypeResolverBuilder

for configuring the resolvers to use

configureHttpMessageCodecsback to summary
public default void configureHttpMessageCodecs(ServerCodecConfigurer configurer)

Configure the HTTP message readers and writers for reading from the request body and for writing to the response body in annotated controllers and functional endpoints.

By default, all built-in readers and writers are configured as long as the corresponding 3rd party libraries such Jackson JSON, JAXB2, and others are present on the classpath.

Parameters
configurer:ServerCodecConfigurer

the configurer to customize readers and writers

configurePathMatchingback to summary
public default void configurePathMatching(PathMatchConfigurer configurer)

Configure path matching options.

The configured path matching options will be used for mapping to annotated controllers and also static resources.

Parameters
configurer:PathMatchConfigurer

the PathMatchConfigurer instance

configureViewResolversback to summary
public default void configureViewResolvers(ViewResolverRegistry registry)

Configure view resolution for rendering responses with a view and a model, where the view is typically an HTML template but could also be based on an HTTP message writer (e.g. JSON, XML).

The configured view resolvers will be used for both annotated controllers and functional endpoints.

getMessageCodesResolverback to summary
public default MessageCodesResolver getMessageCodesResolver()

Provide a custom MessageCodesResolver to use for data binding in annotated controller method arguments instead of the one created by default in org.springframework.validation.DataBinder.

Annotations
@Nullable
getValidatorback to summary
public default Validator getValidator()

Provide a custom Validator.

By default a validator for standard bean validation is created if bean validation API is present on the classpath.

The configured validator is used for validating annotated controller method arguments.

Annotations
@Nullable
getWebSocketServiceback to summary
public default WebSocketService getWebSocketService()

Provide the WebSocketService to create org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter with. This can be used to configure server-specific properties through the org.springframework.web.reactive.socket.server.RequestUpgradeStrategy.

Annotations
@Nullable
Since
5.3