org.springframework.web.servlet.config.annotation
Class DelegatingWebMvcConfiguration

java.lang.Object
  extended by org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
      extended by org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration
All Implemented Interfaces:
Aware, ApplicationContextAware, ServletContextAware

@Configuration
public class DelegatingWebMvcConfiguration
extends WebMvcConfigurationSupport

Extends WebMvcConfigurationSupport with the ability to detect beans of type WebMvcConfigurer and give them a chance to customize the provided configuration by delegating to them at the appropriate times.

Since:
3.1
Author:
Rossen Stoyanchev
See Also:
EnableWebMvc

Constructor Summary
DelegatingWebMvcConfiguration()
           
 
Method Summary
protected  void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
          Add custom HandlerMethodArgumentResolvers to use in addition to the ones registered by default.
protected  void addFormatters(FormatterRegistry registry)
          Override this method to add custom Converters and Formatters.
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(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 configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
          Override this method to configure "default" Servlet handling.
protected  void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
          Override this method to configure the list of HandlerExceptionResolvers to use.
protected  void configureMessageConverters(List<HttpMessageConverter<?>> converters)
          Override this method to add custom HttpMessageConverters to use with the RequestMappingHandlerAdapter and the ExceptionHandlerExceptionResolver.
protected  Validator getValidator()
          Override this method to provide a custom Validator.
 void setConfigurers(List<WebMvcConfigurer> configurers)
           
 
Methods inherited from class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
addDefaultHandlerExceptionResolvers, addDefaultHttpMessageConverters, beanNameHandlerMapping, defaultServletHandlerMapping, getInterceptors, getMessageConverters, handlerExceptionResolver, httpRequestHandlerAdapter, mvcConversionService, mvcValidator, requestMappingHandlerAdapter, requestMappingHandlerMapping, resourceHandlerMapping, setApplicationContext, setServletContext, simpleControllerHandlerAdapter, viewControllerHandlerMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingWebMvcConfiguration

public DelegatingWebMvcConfiguration()
Method Detail

setConfigurers

@Autowired(required=false)
public void setConfigurers(List<WebMvcConfigurer> configurers)

addInterceptors

protected void addInterceptors(InterceptorRegistry registry)
Description copied from class: WebMvcConfigurationSupport
Override this method to add Spring MVC interceptors for pre- and post-processing of controller invocation.

Overrides:
addInterceptors in class WebMvcConfigurationSupport
See Also:
InterceptorRegistry

addViewControllers

protected void addViewControllers(ViewControllerRegistry registry)
Description copied from class: WebMvcConfigurationSupport
Override this method to add view controllers.

Overrides:
addViewControllers in class WebMvcConfigurationSupport
See Also:
ViewControllerRegistry

addResourceHandlers

protected void addResourceHandlers(ResourceHandlerRegistry registry)
Description copied from class: WebMvcConfigurationSupport
Override this method to add resource handlers for serving static resources.

Overrides:
addResourceHandlers in class WebMvcConfigurationSupport
See Also:
ResourceHandlerRegistry

configureDefaultServletHandling

protected void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Description copied from class: WebMvcConfigurationSupport
Override this method to configure "default" Servlet handling.

Overrides:
configureDefaultServletHandling in class WebMvcConfigurationSupport
See Also:
DefaultServletHandlerConfigurer

addArgumentResolvers

protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Description copied from class: WebMvcConfigurationSupport
Add custom 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.

Overrides:
addArgumentResolvers in class WebMvcConfigurationSupport
Parameters:
argumentResolvers - the list of custom converters; initially an empty list.

addReturnValueHandlers

protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
Description copied from class: WebMvcConfigurationSupport
Add custom 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.

Overrides:
addReturnValueHandlers in class WebMvcConfigurationSupport
Parameters:
returnValueHandlers - the list of custom handlers; initially an empty list.

configureMessageConverters

protected void configureMessageConverters(List<HttpMessageConverter<?>> converters)
Description copied from class: WebMvcConfigurationSupport
Override this method to add custom 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(List) that can be used to add default message converters.

Overrides:
configureMessageConverters in class WebMvcConfigurationSupport
Parameters:
converters - a list to add message converters to; initially an empty list.

addFormatters

protected void addFormatters(FormatterRegistry registry)
Description copied from class: WebMvcConfigurationSupport
Override this method to add custom Converters and Formatters.

Overrides:
addFormatters in class WebMvcConfigurationSupport

getValidator

protected Validator getValidator()
Description copied from class: WebMvcConfigurationSupport
Override this method to provide a custom Validator.

Overrides:
getValidator in class WebMvcConfigurationSupport

configureHandlerExceptionResolvers

protected void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
Description copied from class: WebMvcConfigurationSupport
Override this method to configure the list of HandlerExceptionResolvers to use. Adding resolvers to the list turns off the default resolvers that would otherwise be registered by default. Also see WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(List) that can be used to add the default exception resolvers.

Overrides:
configureHandlerExceptionResolvers in class WebMvcConfigurationSupport
Parameters:
exceptionResolvers - a list to add exception resolvers to; initially an empty list.