@Configuration public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport
WebMvcConfigurationSupport
that detects and delegates
to all beans of type WebMvcConfigurer
allowing them to customize the
configuration provided by WebMvcConfigurationSupport
. This is the
class actually imported by @EnableWebMvc
.Constructor and Description |
---|
DelegatingWebMvcConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected void |
addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
Add custom
HandlerMethodArgumentResolvers
to use in addition to the ones registered by default. |
protected void |
addCorsMappings(CorsRegistry registry)
Override this method to configure cross origin requests processing.
|
protected void |
addFormatters(FormatterRegistry registry)
Override this method to add custom
Converter and/or Formatter
delegates to the common FormattingConversionService . |
protected void |
addInterceptors(InterceptorRegistry registry)
Override this method to add Spring MVC interceptors for
pre- and post-processing of controller invocation.
|
protected void |
addResourceHandlers(ResourceHandlerRegistry registry)
Override this method to add resource handlers for serving static resources.
|
protected void |
addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
Add custom
HandlerMethodReturnValueHandlers
in addition to the ones registered by default. |
protected void |
addViewControllers(ViewControllerRegistry registry)
Override this method to add view controllers.
|
protected void |
configureAsyncSupport(AsyncSupportConfigurer configurer)
Override this method to configure asynchronous request processing options.
|
protected void |
configureContentNegotiation(ContentNegotiationConfigurer configurer)
Override this method to configure content negotiation.
|
protected void |
configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Override this method to configure "default" Servlet handling.
|
protected void |
configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
Override this method to configure the list of
HandlerExceptionResolvers to use. |
protected void |
configureMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
Override this method to add custom
HttpMessageConverters
to use with the RequestMappingHandlerAdapter and the
ExceptionHandlerExceptionResolver . |
protected void |
configurePathMatch(PathMatchConfigurer configurer)
Override this method to configure path matching options.
|
protected void |
configureViewResolvers(ViewResolverRegistry registry)
Override this method to configure view resolution.
|
protected void |
extendHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
Override this method to extend or modify the list of
HandlerExceptionResolvers after it has been configured. |
protected void |
extendMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
Override this method to extend or modify the list of converters after it has
been configured.
|
protected MessageCodesResolver |
getMessageCodesResolver()
Override this method to provide a custom
MessageCodesResolver . |
protected Validator |
getValidator()
Override this method to provide a custom
Validator . |
void |
setConfigurers(java.util.List<WebMvcConfigurer> configurers) |
addDefaultHandlerExceptionResolvers, addDefaultHttpMessageConverters, beanNameHandlerMapping, createExceptionHandlerExceptionResolver, createRequestMappingHandlerAdapter, createRequestMappingHandlerMapping, defaultServletHandlerMapping, getApplicationContext, getArgumentResolvers, getConfigurableWebBindingInitializer, getCorsConfigurations, getDefaultMediaTypes, getInterceptors, getMessageConverters, getPathMatchConfigurer, getReturnValueHandlers, getServletContext, handlerExceptionResolver, httpRequestHandlerAdapter, mvcContentNegotiationManager, mvcConversionService, mvcHandlerMappingIntrospector, mvcPathMatcher, mvcResourceUrlProvider, mvcUriComponentsContributor, mvcUrlPathHelper, mvcValidator, mvcViewResolver, requestMappingHandlerAdapter, requestMappingHandlerMapping, resourceHandlerMapping, setApplicationContext, setServletContext, simpleControllerHandlerAdapter, viewControllerHandlerMapping
@Autowired(required=false) public void setConfigurers(java.util.List<WebMvcConfigurer> configurers)
protected void configurePathMatch(PathMatchConfigurer configurer)
WebMvcConfigurationSupport
configurePathMatch
in class WebMvcConfigurationSupport
PathMatchConfigurer
protected void configureContentNegotiation(ContentNegotiationConfigurer configurer)
WebMvcConfigurationSupport
configureContentNegotiation
in class WebMvcConfigurationSupport
DefaultServletHandlerConfigurer
protected void configureAsyncSupport(AsyncSupportConfigurer configurer)
WebMvcConfigurationSupport
configureAsyncSupport
in class WebMvcConfigurationSupport
AsyncSupportConfigurer
protected void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
WebMvcConfigurationSupport
configureDefaultServletHandling
in class WebMvcConfigurationSupport
DefaultServletHandlerConfigurer
protected void addFormatters(FormatterRegistry registry)
WebMvcConfigurationSupport
Converter
and/or Formatter
delegates to the common FormattingConversionService
.addFormatters
in class WebMvcConfigurationSupport
WebMvcConfigurationSupport.mvcConversionService()
protected void addInterceptors(InterceptorRegistry registry)
WebMvcConfigurationSupport
addInterceptors
in class WebMvcConfigurationSupport
InterceptorRegistry
protected void addResourceHandlers(ResourceHandlerRegistry registry)
WebMvcConfigurationSupport
addResourceHandlers
in class WebMvcConfigurationSupport
ResourceHandlerRegistry
protected void addCorsMappings(CorsRegistry registry)
WebMvcConfigurationSupport
addCorsMappings
in class WebMvcConfigurationSupport
CorsRegistry
protected void addViewControllers(ViewControllerRegistry registry)
WebMvcConfigurationSupport
addViewControllers
in class WebMvcConfigurationSupport
ViewControllerRegistry
protected void configureViewResolvers(ViewResolverRegistry registry)
WebMvcConfigurationSupport
configureViewResolvers
in class WebMvcConfigurationSupport
ViewResolverRegistry
protected void addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
WebMvcConfigurationSupport
HandlerMethodArgumentResolvers
to use in addition to the ones registered by default.
Custom argument resolvers are invoked before built-in resolvers except for
those that rely on the presence of annotations (e.g. @RequestParameter
,
@PathVariable
, etc). The latter can be customized by configuring the
RequestMappingHandlerAdapter
directly.
addArgumentResolvers
in class WebMvcConfigurationSupport
argumentResolvers
- the list of custom converters (initially an empty list)protected void addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
WebMvcConfigurationSupport
HandlerMethodReturnValueHandlers
in addition to the ones registered by default.
Custom return value handlers are invoked before built-in ones except for
those that rely on the presence of annotations (e.g. @ResponseBody
,
@ModelAttribute
, etc). The latter can be customized by configuring the
RequestMappingHandlerAdapter
directly.
addReturnValueHandlers
in class WebMvcConfigurationSupport
returnValueHandlers
- the list of custom handlers (initially an empty list)protected void configureMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
WebMvcConfigurationSupport
HttpMessageConverters
to use with the RequestMappingHandlerAdapter
and the
ExceptionHandlerExceptionResolver
.
Adding converters to the list turns off the default converters that would
otherwise be registered by default. Also see WebMvcConfigurationSupport.addDefaultHttpMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
for adding default message converters.
configureMessageConverters
in class WebMvcConfigurationSupport
converters
- a list to add message converters to (initially an empty list)protected void extendMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
WebMvcConfigurationSupport
extendMessageConverters
in class WebMvcConfigurationSupport
converters
- the list of configured converters to extendprotected void configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
WebMvcConfigurationSupport
HandlerExceptionResolvers
to use.
Adding resolvers to the list turns off the default resolvers that would otherwise
be registered by default. Also see WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
that can be used to add the default exception resolvers.
configureHandlerExceptionResolvers
in class WebMvcConfigurationSupport
exceptionResolvers
- a list to add exception resolvers to (initially an empty list)protected void extendHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
WebMvcConfigurationSupport
HandlerExceptionResolvers
after it has been configured.
This may be useful for example to allow default resolvers to be registered and then insert a custom one through this method.
extendHandlerExceptionResolvers
in class WebMvcConfigurationSupport
exceptionResolvers
- the list of configured resolvers to extend.protected Validator getValidator()
WebMvcConfigurationSupport
Validator
.getValidator
in class WebMvcConfigurationSupport
protected MessageCodesResolver getMessageCodesResolver()
WebMvcConfigurationSupport
MessageCodesResolver
.getMessageCodesResolver
in class WebMvcConfigurationSupport