Package org.springframework.web.servlet.config.annotation

# Class DelegatingWebMvcConfiguration

java.lang.Object
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.context.ApplicationContextAware`, `org.springframework.web.context.ServletContextAware`

@Configuration(proxyBeanMethods=false) public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport
A subclass of `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`.

Since:
  3.1
Author:
  Rossen Stoyanchev

## Constructor Summary

Constructors
Constructor
Description
`DelegatingWebMvcConfiguration()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`addArgumentResolvers(List<org.springframework.web.method.support.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(org.springframework.format.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(List<org.springframework.web.method.support.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`
`configureErrorResponseInterceptors(List<org.springframework.web.ErrorResponse.Interceptor> interceptors)`
Override this method for control over the `ErrorResponse.Interceptor`'s to apply when rendering error responses.
`protected void`
`configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)`
Override this method to configure the list of `HandlerExceptionResolvers` to use.
`protected void`
`configureMessageConverters(List<org.springframework.http.converter.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(List<HandlerExceptionResolver> exceptionResolvers)`
Override this method to extend or modify the list of `HandlerExceptionResolvers` after it has been configured.
`protected void`
`extendMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)`
Override this method to extend or modify the list of converters after it has been configured.
`protected org.springframework.validation.MessageCodesResolver`
`getMessageCodesResolver()`
Override this method to provide a custom `MessageCodesResolver`.
`protected org.springframework.validation.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, createExceptionHandlerExceptionResolver, createRequestMappingHandlerAdapter, createRequestMappingHandlerMapping, defaultServletHandlerMapping, flashMapManager, getApplicationContext, getArgumentResolvers, getAsyncSupportConfigurer, getConfigurableWebBindingInitializer, getCorsConfigurations, getDefaultMediaTypes, getErrorResponseInterceptors, getInterceptors, getMessageConverters, getPathMatchConfigurer, getReturnValueHandlers, getServletContext, handlerExceptionResolver, handlerFunctionAdapter, httpRequestHandlerAdapter, localeResolver, mvcContentNegotiationManager, mvcConversionService, mvcHandlerMappingIntrospector, mvcPathMatcher, mvcPatternParser, mvcResourceUrlProvider, mvcUriComponentsContributor, mvcUrlPathHelper, mvcValidator, mvcViewResolver, requestMappingHandlerAdapter, requestMappingHandlerMapping, resourceHandlerMapping, routerFunctionMapping, setApplicationContext, setServletContext, simpleControllerHandlerAdapter, themeResolver, viewControllerHandlerMapping, viewNameTranslator`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DelegatingWebMvcConfiguration

public DelegatingWebMvcConfiguration()

## Method Details

### setConfigurers

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

### configurePathMatch

protected void configurePathMatch(PathMatchConfigurer configurer)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to configure path matching options.

Overrides:
  `configurePathMatch` in class `WebMvcConfigurationSupport`
See Also:
  - `PathMatchConfigurer`

### configureContentNegotiation

protected void configureContentNegotiation(ContentNegotiationConfigurer configurer)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to configure content negotiation.

Overrides:
  `configureContentNegotiation` in class `WebMvcConfigurationSupport`
See Also:
  - `DefaultServletHandlerConfigurer`

### configureAsyncSupport

protected void configureAsyncSupport(AsyncSupportConfigurer configurer)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to configure asynchronous request processing options.

Overrides:
  `configureAsyncSupport` in class `WebMvcConfigurationSupport`
See Also:
  - `AsyncSupportConfigurer`

### 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`

### addFormatters

protected void addFormatters(org.springframework.format.FormatterRegistry registry)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to add custom `Converter` and/or `Formatter` delegates to the common `FormattingConversionService`.

Overrides:
  `addFormatters` in class `WebMvcConfigurationSupport`
See Also:
  - `WebMvcConfigurationSupport.mvcConversionService()`

### 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`

### 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`

### addCorsMappings

protected void addCorsMappings(CorsRegistry registry)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to configure cross-origin requests processing.

Overrides:
  `addCorsMappings` in class `WebMvcConfigurationSupport`
See Also:
  - `CorsRegistry`

### 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`

### configureViewResolvers

protected void configureViewResolvers(ViewResolverRegistry registry)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to configure view resolution.

Overrides:
  `configureViewResolvers` in class `WebMvcConfigurationSupport`
See Also:
  - `ViewResolverRegistry`

### addArgumentResolvers

protected void addArgumentResolvers(List<org.springframework.web.method.support.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 (for example, `@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<org.springframework.web.method.support.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 (for example, `@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<org.springframework.http.converter.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(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)` for adding default message converters.

Overrides:
  `configureMessageConverters` in class `WebMvcConfigurationSupport`
Parameters:
  `converters` - a list to add message converters to (initially an empty list)

### extendMessageConverters

protected void extendMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to extend or modify the list of converters after it has been configured. This may be useful for example to allow default converters to be registered and then insert a custom converter through this method.

Overrides:
  `extendMessageConverters` in class `WebMvcConfigurationSupport`
Parameters:
  `converters` - the list of configured converters to extend

### 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(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>, org.springframework.web.accept.ContentNegotiationManager)` 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)

### extendHandlerExceptionResolvers

protected void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
Description copied from class: `WebMvcConfigurationSupport`
Override this method to extend or modify the list of `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.

Overrides:
  `extendHandlerExceptionResolvers` in class `WebMvcConfigurationSupport`
Parameters:
  `exceptionResolvers` - the list of configured resolvers to extend.

### configureErrorResponseInterceptors

protected void configureErrorResponseInterceptors(List<org.springframework.web.ErrorResponse.Interceptor> interceptors)
Description copied from class: `WebMvcConfigurationSupport`
Override this method for control over the `ErrorResponse.Interceptor`'s to apply when rendering error responses.

Overrides:
  `configureErrorResponseInterceptors` in class `WebMvcConfigurationSupport`
Parameters:
  `interceptors` - the list to add handlers to

### getValidator

@Nullable protected org.springframework.validation.Validator getValidator()
Description copied from class: `WebMvcConfigurationSupport`
Override this method to provide a custom `Validator`.

Overrides:
  `getValidator` in class `WebMvcConfigurationSupport`

### getMessageCodesResolver

@Nullable protected org.springframework.validation.MessageCodesResolver getMessageCodesResolver()
Description copied from class: `WebMvcConfigurationSupport`
Override this method to provide a custom `MessageCodesResolver`.

Overrides:
  `getMessageCodesResolver` in class `WebMvcConfigurationSupport`