接口 WebFluxConfigurer
- 所有已知实现类:
WebFluxConfigurerComposite
public interface WebFluxConfigurer
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.- 从以下版本开始:
- 5.0
- 作者:
- Brian Clozel, Rossen Stoyanchev
- 另请参阅:
WebFluxConfigurationSupport
,DelegatingWebFluxConfiguration
方法概要
所有方法 实例方法 默认方法 修饰符和类型 方法 说明 default void
addCorsMappings(CorsRegistry registry)
Configure "global" cross origin request processing.default void
addFormatters(FormatterRegistry registry)
Add customConverters
andFormatters
for performing type conversion and formatting of annotated controller method arguments.default void
addResourceHandlers(ResourceHandlerRegistry registry)
Add resource handlers for serving static resources.default void
configureArgumentResolvers(ArgumentResolverConfigurer configurer)
Configure resolvers for custom@RequestMapping
method arguments.default void
configureContentTypeResolver(RequestedContentTypeResolverBuilder builder)
Configure how the content type requested for the response is resolved when handling requests with annotated controllers.default void
configureHttpMessageCodecs(ServerCodecConfigurer configurer)
Configure custom HTTP message readers and writers or override built-in ones.default void
configurePathMatching(PathMatchConfigurer configurer)
Configure path matching options.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.default MessageCodesResolver
getMessageCodesResolver()
Provide a customMessageCodesResolver
to use for data binding in annotated controller method arguments instead of the one created by default inDataBinder
.default Validator
getValidator()
Provide a customValidator
.
方法详细资料
configureContentTypeResolver
default void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder)
Configure how the content type requested for the response is resolved when handling requests with annotated controllers.- 参数:
builder
- for configuring the resolvers to use
addCorsMappings
default void addCorsMappings(CorsRegistry registry)
Configure "global" cross origin request processing.The configured readers and writers will apply to all requests including annotated controllers and functional endpoints. Annotated controllers can further declare more fine-grained configuration via
@CrossOrigin
.- 另请参阅:
CorsRegistry
configurePathMatching
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
.- 参数:
configurer
- thePathMatchConfigurer
instance
addResourceHandlers
default void addResourceHandlers(ResourceHandlerRegistry registry)
Add resource handlers for serving static resources.
configureArgumentResolvers
default void configureArgumentResolvers(ArgumentResolverConfigurer configurer)
Configure resolvers for custom@RequestMapping
method arguments.- 参数:
configurer
- to configurer to use
configureHttpMessageCodecs
default void configureHttpMessageCodecs(ServerCodecConfigurer configurer)
Configure custom HTTP message readers and writers or override built-in ones.The configured readers and writers will be used for both annotated controllers and functional endpoints.
- 参数:
configurer
- the configurer to use
addFormatters
default void addFormatters(FormatterRegistry registry)
Add customConverters
andFormatters
for performing type conversion and formatting of annotated controller method arguments.
getValidator
@Nullable default Validator getValidator()
Provide a customValidator
.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.
getMessageCodesResolver
@Nullable default MessageCodesResolver getMessageCodesResolver()
Provide a customMessageCodesResolver
to use for data binding in annotated controller method arguments instead of the one created by default inDataBinder
.
configureViewResolvers
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.