接口 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 voidaddCorsMappings(CorsRegistry registry)Configure "global" cross origin request processing.default voidaddFormatters(FormatterRegistry registry)Add customConvertersandFormattersfor performing type conversion and formatting of annotated controller method arguments.default voidaddResourceHandlers(ResourceHandlerRegistry registry)Add resource handlers for serving static resources.default voidconfigureArgumentResolvers(ArgumentResolverConfigurer configurer)Configure resolvers for custom@RequestMappingmethod arguments.default voidconfigureContentTypeResolver(RequestedContentTypeResolverBuilder builder)Configure how the content type requested for the response is resolved when handling requests with annotated controllers.default voidconfigureHttpMessageCodecs(ServerCodecConfigurer configurer)Configure custom HTTP message readers and writers or override built-in ones.default voidconfigurePathMatching(PathMatchConfigurer configurer)Configure path matching options.default voidconfigureViewResolvers(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 MessageCodesResolvergetMessageCodesResolver()Provide a customMessageCodesResolverto use for data binding in annotated controller method arguments instead of the one created by default inDataBinder.default ValidatorgetValidator()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- thePathMatchConfigurerinstance
addResourceHandlers
default void addResourceHandlers(ResourceHandlerRegistry registry)
Add resource handlers for serving static resources.
configureArgumentResolvers
default void configureArgumentResolvers(ArgumentResolverConfigurer configurer)
Configure resolvers for custom@RequestMappingmethod 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 customConvertersandFormattersfor 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 customMessageCodesResolverto 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.