class WebMvcConfigurerComposite extends java.lang.Object implements WebMvcConfigurer
WebMvcConfigurer
implementation that delegates to other WebMvcConfigurer
instances.Modifier and Type | Field and Description |
---|---|
private java.util.List<WebMvcConfigurer> |
delegates |
Constructor and Description |
---|
WebMvcConfigurerComposite() |
Modifier and Type | Method and Description |
---|---|
void |
addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
Add resolvers to support custom controller method argument types.
|
void |
addFormatters(FormatterRegistry registry)
|
void |
addInterceptors(InterceptorRegistry registry)
Add Spring MVC lifecycle interceptors for pre- and post-processing of
controller method invocations.
|
void |
addResourceHandlers(ResourceHandlerRegistry registry)
Add handlers to serve static resources such as images, js, and, css
files from specific locations under web application root, the classpath,
and others.
|
void |
addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
Add handlers to support custom controller method return value types.
|
void |
addViewControllers(ViewControllerRegistry registry)
Add view controllers to create a direct mapping between a URL path and
view name without the need for a controller in between.
|
void |
addWebMvcConfigurers(java.util.List<WebMvcConfigurer> configurers) |
void |
configureAsyncSupport(AsyncSupportConfigurer configurer)
Configure asynchronous request handling options.
|
void |
configureContentNegotiation(ContentNegotiationConfigurer configurer)
Configure content negotiation options.
|
void |
configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Configure a handler to delegate unhandled requests by forwarding to the
Servlet container's "default" servlet.
|
void |
configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
Configure the
HandlerExceptionResolver s to handle unresolved
controller exceptions. |
void |
configureMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
Configure the
HttpMessageConverter s to use in argument resolvers
and return value handlers that support reading and/or writing to the
body of the request and response. |
void |
configurePathMatch(PathMatchConfigurer configurer)
Configure path matching options.
|
MessageCodesResolver |
getMessageCodesResolver()
Provide a custom
MessageCodesResolver for building message codes
from data binding and validation error codes. |
Validator |
getValidator()
Provide a custom
Validator instead of the one created by default. |
private <T> T |
selectSingleInstance(java.util.List<T> instances,
java.lang.Class<T> instanceType) |
private final java.util.List<WebMvcConfigurer> delegates
public void addWebMvcConfigurers(java.util.List<WebMvcConfigurer> configurers)
public void addFormatters(FormatterRegistry registry)
WebMvcConfigurer
addFormatters
in interface WebMvcConfigurer
public void configureContentNegotiation(ContentNegotiationConfigurer configurer)
WebMvcConfigurer
configureContentNegotiation
in interface WebMvcConfigurer
public void configureAsyncSupport(AsyncSupportConfigurer configurer)
WebMvcConfigurer
configureAsyncSupport
in interface WebMvcConfigurer
public void configurePathMatch(PathMatchConfigurer configurer)
WebMvcConfigurer
configurePathMatch
in interface WebMvcConfigurer
public void configureMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
WebMvcConfigurer
HttpMessageConverter
s to use in argument resolvers
and return value handlers that support reading and/or writing to the
body of the request and response. If no message converters are added to
the list, default converters are added instead.configureMessageConverters
in interface WebMvcConfigurer
converters
- initially an empty list of converterspublic void addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
WebMvcConfigurer
This does not override the built-in support for resolving handler
method arguments. To customize the built-in support for argument
resolution, configure RequestMappingHandlerAdapter
directly.
addArgumentResolvers
in interface WebMvcConfigurer
argumentResolvers
- initially an empty listpublic void addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
WebMvcConfigurer
Using this option does not override the built-in support for handling return values. To customize the built-in support for handling return values, configure RequestMappingHandlerAdapter directly.
addReturnValueHandlers
in interface WebMvcConfigurer
returnValueHandlers
- initially an empty listpublic void configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
WebMvcConfigurer
HandlerExceptionResolver
s to handle unresolved
controller exceptions. If no resolvers are added to the list, default
exception resolvers are added instead.configureHandlerExceptionResolvers
in interface WebMvcConfigurer
exceptionResolvers
- initially an empty listpublic void addInterceptors(InterceptorRegistry registry)
WebMvcConfigurer
addInterceptors
in interface WebMvcConfigurer
public void addViewControllers(ViewControllerRegistry registry)
WebMvcConfigurer
addViewControllers
in interface WebMvcConfigurer
public void addResourceHandlers(ResourceHandlerRegistry registry)
WebMvcConfigurer
addResourceHandlers
in interface WebMvcConfigurer
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
WebMvcConfigurer
DispatcherServlet
is mapped to "/" thus overriding the
Servlet container's default handling of static resources.configureDefaultServletHandling
in interface WebMvcConfigurer
public Validator getValidator()
WebMvcConfigurer
Validator
instead of the one created by default.
The default implementation, assuming JSR-303 is on the classpath, is:
OptionalValidatorFactoryBean
.
Leave the return value as null
to keep the default.getValidator
in interface WebMvcConfigurer
private <T> T selectSingleInstance(java.util.List<T> instances, java.lang.Class<T> instanceType)
public MessageCodesResolver getMessageCodesResolver()
WebMvcConfigurer
MessageCodesResolver
for building message codes
from data binding and validation error codes. Leave the return value as
null
to keep the default.getMessageCodesResolver
in interface WebMvcConfigurer