public abstract class WebMvcConfigurerAdapter extends Object implements WebMvcConfigurer
WebMvcConfigurer
with empty methods allowing
sub-classes to override only the methods they're interested in.Constructor and Description |
---|
WebMvcConfigurerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
addArgumentResolvers(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(List<HandlerMethodReturnValueHandler> returnValueHandlers)
Add handlers to support custom controller method return value types.
|
void |
addViewControllers(ViewControllerRegistry registry)
Configure simple automated controllers pre-configured with the response
status code and/or a view to render the response body.
|
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(List<HandlerExceptionResolver> exceptionResolvers)
Configure the
HandlerExceptionResolver s to handle unresolved
controller exceptions. |
void |
configureMessageConverters(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)
Helps with configuring HandlerMappings path matching options such as trailing slash match,
suffix registration, path matcher and path helper.
|
void |
configureViewResolvers(ViewResolverRegistry registry)
Configure view resolvers to translate String-based view names returned from
controllers into concrete
View
implementations to perform rendering with. |
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. |
public void addFormatters(FormatterRegistry registry)
Converter
s and Formatter
s in addition to the ones
registered by default.
This implementation is empty.
addFormatters
in interface WebMvcConfigurer
public void configureMessageConverters(List<HttpMessageConverter<?>> converters)
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.
This implementation is empty.
configureMessageConverters
in interface WebMvcConfigurer
converters
- initially an empty list of converterspublic Validator getValidator()
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.
This implementation returns null
getValidator
in interface WebMvcConfigurer
public void configureContentNegotiation(ContentNegotiationConfigurer configurer)
This implementation is empty.
configureContentNegotiation
in interface WebMvcConfigurer
public void configureAsyncSupport(AsyncSupportConfigurer configurer)
This implementation is empty.
configureAsyncSupport
in interface WebMvcConfigurer
public void configurePathMatch(PathMatchConfigurer configurer)
This implementation is empty.
configurePathMatch
in interface WebMvcConfigurer
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
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.
This implementation is empty.
addArgumentResolvers
in interface WebMvcConfigurer
argumentResolvers
- initially an empty listpublic void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
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.
This implementation is empty.
addReturnValueHandlers
in interface WebMvcConfigurer
returnValueHandlers
- initially an empty listpublic void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
HandlerExceptionResolver
s to handle unresolved
controller exceptions. If no resolvers are added to the list, default
exception resolvers are added instead.
This implementation is empty.
configureHandlerExceptionResolvers
in interface WebMvcConfigurer
exceptionResolvers
- initially an empty listpublic MessageCodesResolver getMessageCodesResolver()
MessageCodesResolver
for building message codes
from data binding and validation error codes. Leave the return value as
null
to keep the default.
This implementation is empty.
getMessageCodesResolver
in interface WebMvcConfigurer
public void addInterceptors(InterceptorRegistry registry)
This implementation is empty.
addInterceptors
in interface WebMvcConfigurer
public void addViewControllers(ViewControllerRegistry registry)
This implementation is empty.
addViewControllers
in interface WebMvcConfigurer
public void configureViewResolvers(ViewResolverRegistry registry)
View
implementations to perform rendering with.
This implementation is empty.
configureViewResolvers
in interface WebMvcConfigurer
public void addResourceHandlers(ResourceHandlerRegistry registry)
This implementation is empty.
addResourceHandlers
in interface WebMvcConfigurer
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
DispatcherServlet
is mapped to "/" thus overriding the
Servlet container's default handling of static resources.
This implementation is empty.
configureDefaultServletHandling
in interface WebMvcConfigurer