public interface WebFluxConfigurer
@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.
Modifier and Type | Method and Description |
---|---|
default void |
addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> resolvers)
Provide custom controller method argument resolvers.
|
default void |
addCorsMappings(CorsRegistry registry)
Configure cross origin requests processing.
|
default void |
addFormatters(FormatterRegistry registry)
|
default void |
addResourceHandlers(ResourceHandlerRegistry registry)
Add resource handlers for serving static resources.
|
default void |
configureContentTypeResolver(RequestedContentTypeResolverBuilder builder)
Configure how the content type requested for the response is resolved.
|
default void |
configureMessageReaders(java.util.List<HttpMessageReader<?>> readers)
Configure the message readers to use for decoding the request body where
@RequestBody and HttpEntity controller method arguments
are used. |
default void |
configureMessageWriters(java.util.List<HttpMessageWriter<?>> writers)
Configure the message writers to use to encode the response body based on
the return values of
@ResponseBody , and ResponseEntity
controller methods. |
default void |
configurePathMatching(PathMatchConfigurer configurer)
Configure path matching options.
|
default void |
configureViewResolvers(ViewResolverRegistry registry)
Configure view resolution for processing the return values of controller
methods that rely on resolving a
View to render
the response with. |
default void |
extendMessageReaders(java.util.List<HttpMessageReader<?>> readers)
An alternative to
configureMessageReaders(List) that allows
modifying the message readers to use after default ones have been added. |
default void |
extendMessageWriters(java.util.List<HttpMessageWriter<?>> writers)
An alternative to
configureMessageWriters(List) that allows
modifying the message writers to use after default ones have been added. |
default java.util.Optional<MessageCodesResolver> |
getMessageCodesResolver()
Provide a custom
MessageCodesResolver to use for data binding
instead of the one created by default in
DataBinder . |
default java.util.Optional<Validator> |
getValidator()
Provide a custom
Validator . |
default void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder)
The given builder will create a composite of multiple
RequestedContentTypeResolver
s, each defining a way to resolve
the requested content type (accept HTTP header, path extension,
parameter, etc).
builder
- factory that creates a CompositeContentTypeResolver
default void addCorsMappings(CorsRegistry registry)
CorsRegistry
default void configurePathMatching(PathMatchConfigurer configurer)
The given configurer assists with configuring
HandlerMapping
s with path matching options.
configurer
- the PathMatchConfigurer
instancedefault void addResourceHandlers(ResourceHandlerRegistry registry)
ResourceHandlerRegistry
default void addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> resolvers)
resolvers
- a list of resolvers to adddefault void configureMessageReaders(java.util.List<HttpMessageReader<?>> readers)
@RequestBody
and HttpEntity
controller method arguments
are used. If none are specified, default ones are added based on
WebFluxConfigurationSupport.addDefaultHttpMessageReaders(java.util.List<org.springframework.http.codec.HttpMessageReader<?>>)
.
See extendMessageReaders(List)
for adding readers
in addition to the default ones.
readers
- an empty list to add message readers todefault void extendMessageReaders(java.util.List<HttpMessageReader<?>> readers)
configureMessageReaders(List)
that allows
modifying the message readers to use after default ones have been added.default void addFormatters(FormatterRegistry registry)
default java.util.Optional<Validator> getValidator()
Validator
.
By default a validator for standard bean validation is created if bean validation api is present on the classpath.
default java.util.Optional<MessageCodesResolver> getMessageCodesResolver()
MessageCodesResolver
to use for data binding
instead of the one created by default in
DataBinder
.default void configureMessageWriters(java.util.List<HttpMessageWriter<?>> writers)
@ResponseBody
, and ResponseEntity
controller methods. If none are specified, default ones are added based on
WebFluxConfigurationSupport.addDefaultHttpMessageWriters(List)
.
See extendMessageWriters(List)
for adding writers
in addition to the default ones.
writers
- a empty list to add message writers todefault void extendMessageWriters(java.util.List<HttpMessageWriter<?>> writers)
configureMessageWriters(List)
that allows
modifying the message writers to use after default ones have been added.default void configureViewResolvers(ViewResolverRegistry registry)
View
to render
the response with. By default all controller methods rely on view
resolution unless annotated with @ResponseBody
or explicitly
return ResponseEntity
. A view may be specified explicitly with
a String return value or implicitly, e.g. void
return value.ViewResolverRegistry