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

# Class WebMvcConfigurationSupport

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

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

Direct Known Subclasses:
  `DelegatingWebMvcConfiguration`

public class WebMvcConfigurationSupport extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware
This is the main class providing the configuration behind the MVC Java config. It is typically imported by adding `@EnableWebMvc` to an application `@Configuration` class. An alternative more advanced option is to extend directly from this class and override methods as necessary, remembering to add `@Configuration` to the subclass and `@Bean` to overridden `@Bean` methods. For more details see the javadoc of `@EnableWebMvc`.

This class registers the following `HandlerMappings`:

- `RouterFunctionMapping` ordered at -1 to map router functions.
- `RequestMappingHandlerMapping` ordered at 0 for mapping requests to annotated controller methods.
- `HandlerMapping` ordered at 1 to map URL paths directly to view names.
- `BeanNameUrlHandlerMapping` ordered at 2 to map URL paths to controller bean names.
- `HandlerMapping` ordered at `Integer.MAX_VALUE-1` to serve static resource requests.
- `HandlerMapping` ordered at `Integer.MAX_VALUE` to forward requests to the default servlet.

Registers these `HandlerAdapters`:

- `RequestMappingHandlerAdapter` for processing requests with annotated controller methods.
- `HttpRequestHandlerAdapter` for processing requests with `HttpRequestHandlers`.
- `SimpleControllerHandlerAdapter` for processing requests with interface-based `Controllers`.
- `HandlerFunctionAdapter` for processing requests with router functions.

Registers a `HandlerExceptionResolverComposite` with this chain of exception resolvers:

- `ExceptionHandlerExceptionResolver` for handling exceptions through `ExceptionHandler` methods.
- `ResponseStatusExceptionResolver` for exceptions annotated with `ResponseStatus`.
- `DefaultHandlerExceptionResolver` for resolving known Spring exception types

Registers an `AntPathMatcher` and a `UrlPathHelper` to be used by:

- the `RequestMappingHandlerMapping`,
- the `HandlerMapping` for ViewControllers
- and the `HandlerMapping` for serving resources

Note that those beans can be configured with a `PathMatchConfigurer`.

Both the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver` are configured with default instances of the following by default:

- a `ContentNegotiationManager`
- a `DefaultFormattingConversionService`
- an `OptionalValidatorFactoryBean` if a JSR-303 implementation is available on the classpath
- a range of `HttpMessageConverters` depending on the third-party libraries available on the classpath.

Since:
  3.1
Author:
  Rossen Stoyanchev, Brian Clozel, Sebastien Deleuze, Hyoungjune Kim
See Also:
  - `EnableWebMvc`
  - `WebMvcConfigurer`

## Constructor Summary

Constructors
Constructor
Description
`WebMvcConfigurationSupport()`

## 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 final void`
`addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers, org.springframework.web.accept.ContentNegotiationManager mvcContentNegotiationManager)`
A method available to subclasses for adding default `HandlerExceptionResolvers`.
`protected final void`
`addDefaultHttpMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)`
Adds a set of default HttpMessageConverter instances to the given list.
`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.
`BeanNameUrlHandlerMapping`
`beanNameHandlerMapping(org.springframework.format.support.FormattingConversionService conversionService, ResourceUrlProvider resourceUrlProvider)`
Return a `BeanNameUrlHandlerMapping` ordered at 2 to map URL paths to controller bean names.
`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 ExceptionHandlerExceptionResolver`
`createExceptionHandlerExceptionResolver()`
Protected method for plugging in a custom subclass of `ExceptionHandlerExceptionResolver`.
`protected RequestMappingHandlerAdapter`
`createRequestMappingHandlerAdapter()`
Protected method for plugging in a custom subclass of `RequestMappingHandlerAdapter`.
`protected RequestMappingHandlerMapping`
`createRequestMappingHandlerMapping()`
Protected method for plugging in a custom subclass of `RequestMappingHandlerMapping`.
`HandlerMapping`
`defaultServletHandlerMapping()`
Return a handler mapping ordered at Integer.MAX_VALUE with a mapped default servlet handler.
`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.
`FlashMapManager`
`flashMapManager()`
`final org.springframework.context.ApplicationContext`
`getApplicationContext()`
Return the associated Spring `ApplicationContext`.
`protected final List<org.springframework.web.method.support.HandlerMethodArgumentResolver>`
`getArgumentResolvers()`
Provide access to the shared custom argument resolvers used by the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver`.
`protected AsyncSupportConfigurer`
`getAsyncSupportConfigurer()`
Callback for building the `AsyncSupportConfigurer`.
`protected org.springframework.web.bind.support.ConfigurableWebBindingInitializer`
`getConfigurableWebBindingInitializer(org.springframework.format.support.FormattingConversionService mvcConversionService, org.springframework.validation.Validator mvcValidator)`
Return the `ConfigurableWebBindingInitializer` to use for initializing all `WebDataBinder` instances.
`protected final Map<String,org.springframework.web.cors.CorsConfiguration>`
`getCorsConfigurations()`
Return the registered `CorsConfiguration` objects, keyed by path pattern.
`protected Map<String,org.springframework.http.MediaType>`
`getDefaultMediaTypes()`
`protected final List<org.springframework.web.ErrorResponse.Interceptor>`
`getErrorResponseInterceptors()`
Provide access to the list of `ErrorResponse.Interceptor`'s to apply when rendering error responses.
`protected final Object[]`
`getInterceptors(org.springframework.format.support.FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider)`
Provide access to the shared handler interceptors used to configure `HandlerMapping` instances with.
`protected org.springframework.validation.MessageCodesResolver`
`getMessageCodesResolver()`
Override this method to provide a custom `MessageCodesResolver`.
`protected final List<org.springframework.http.converter.HttpMessageConverter<?>>`
`getMessageConverters()`
Provides access to the shared `HttpMessageConverters` used by the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver`.
`protected PathMatchConfigurer`
`getPathMatchConfigurer()`
Callback for building the `PathMatchConfigurer`.
`protected final List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>`
`getReturnValueHandlers()`
Provide access to the shared return value handlers used by the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver`.
`final ServletContext`
`getServletContext()`
Return the associated `ServletContext`.
`protected org.springframework.validation.Validator`
`getValidator()`
Override this method to provide a custom `Validator`.
`HandlerExceptionResolver`
`handlerExceptionResolver(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)`
Returns a `HandlerExceptionResolverComposite` containing a list of exception resolvers obtained either through `configureHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)` or through `addDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>, org.springframework.web.accept.ContentNegotiationManager)`.
`HandlerFunctionAdapter`
`handlerFunctionAdapter()`
Returns a `HandlerFunctionAdapter` for processing requests through handler functions.
`HttpRequestHandlerAdapter`
`httpRequestHandlerAdapter()`
Returns a `HttpRequestHandlerAdapter` for processing requests with `HttpRequestHandlers`.
`LocaleResolver`
`localeResolver()`
`org.springframework.web.accept.ContentNegotiationManager`
`mvcContentNegotiationManager()`
Return a `ContentNegotiationManager` instance to use to determine requested media types in a given request.
`org.springframework.format.support.FormattingConversionService`
`mvcConversionService()`
Return a `FormattingConversionService` for use with annotated controllers.
`HandlerMappingIntrospector`
`mvcHandlerMappingIntrospector()`
`org.springframework.util.PathMatcher`
`mvcPathMatcher()`
Return a global `PathMatcher` instance which is used for URL path matching with String patterns.
`org.springframework.web.util.pattern.PathPatternParser`
`mvcPatternParser()`
Return a global `PathPatternParser` instance to use for parsing patterns to match to the `RequestPath`.
`ResourceUrlProvider`
`mvcResourceUrlProvider()`
A `ResourceUrlProvider` bean for use with the MVC dispatcher.
`org.springframework.web.method.support.CompositeUriComponentsContributor`
`mvcUriComponentsContributor(org.springframework.format.support.FormattingConversionService conversionService, RequestMappingHandlerAdapter requestMappingHandlerAdapter)`
Return an instance of `CompositeUriComponentsContributor` for use with `MvcUriComponentsBuilder`.
`org.springframework.web.util.UrlPathHelper`
`mvcUrlPathHelper()`
Return a global `UrlPathHelper` instance which is used to resolve the request mapping path for an application.
`org.springframework.validation.Validator`
`mvcValidator()`
Return a global `Validator` instance for example for validating `@ModelAttribute` and `@RequestBody` method arguments.
`ViewResolver`
`mvcViewResolver(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)`
Register a `ViewResolverComposite` that contains a chain of view resolvers to use for view resolution.
`RequestMappingHandlerAdapter`
`requestMappingHandlerAdapter(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, org.springframework.format.support.FormattingConversionService conversionService, org.springframework.validation.Validator validator)`
Returns a `RequestMappingHandlerAdapter` for processing requests through annotated controller methods.
`RequestMappingHandlerMapping`
`requestMappingHandlerMapping(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, org.springframework.format.support.FormattingConversionService conversionService, ResourceUrlProvider resourceUrlProvider)`
Return a `RequestMappingHandlerMapping` ordered at 0 for mapping requests to annotated controllers.
`HandlerMapping`
`resourceHandlerMapping(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, org.springframework.format.support.FormattingConversionService conversionService, ResourceUrlProvider resourceUrlProvider)`
Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers.
`RouterFunctionMapping`
`routerFunctionMapping(org.springframework.format.support.FormattingConversionService conversionService, ResourceUrlProvider resourceUrlProvider)`
Return a `RouterFunctionMapping` ordered at -1 to map router functions.
`void`
`setApplicationContext(org.springframework.context.ApplicationContext applicationContext)`
Set the Spring `ApplicationContext`, for example, for resource loading.
`void`
`setServletContext(ServletContext servletContext)`
Set the `ServletContext`, for example, for resource handling, looking up file extensions, etc.
`SimpleControllerHandlerAdapter`
`simpleControllerHandlerAdapter()`
Returns a `SimpleControllerHandlerAdapter` for processing requests with interface-based controllers.
`ThemeResolver`
`themeResolver()`
Deprecated.
`HandlerMapping`
`viewControllerHandlerMapping(org.springframework.format.support.FormattingConversionService conversionService, ResourceUrlProvider resourceUrlProvider)`
Return a handler mapping ordered at 1 to map URL paths directly to view names.
`RequestToViewNameTranslator`
`viewNameTranslator()`

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

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

## Constructor Details

### WebMvcConfigurationSupport

public WebMvcConfigurationSupport()

## Method Details

### setApplicationContext

public void setApplicationContext(@Nullable org.springframework.context.ApplicationContext applicationContext)
Set the Spring `ApplicationContext`, for example, for resource loading.

Specified by:
  `setApplicationContext` in interface `org.springframework.context.ApplicationContextAware`

### getApplicationContext

@Nullable public final org.springframework.context.ApplicationContext getApplicationContext()
Return the associated Spring `ApplicationContext`.

Since:
  4.2

### setServletContext

public void setServletContext(@Nullable ServletContext servletContext)
Set the `ServletContext`, for example, for resource handling, looking up file extensions, etc.

Specified by:
  `setServletContext` in interface `org.springframework.web.context.ServletContextAware`

### getServletContext

@Nullable public final ServletContext getServletContext()
Return the associated `ServletContext`.

Since:
  4.2

### requestMappingHandlerMapping

@Bean public RequestMappingHandlerMapping requestMappingHandlerMapping(@Qualifier("mvcContentNegotiationManager") org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, @Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider)
Return a `RequestMappingHandlerMapping` ordered at 0 for mapping requests to annotated controllers.

### createRequestMappingHandlerMapping

protected RequestMappingHandlerMapping createRequestMappingHandlerMapping()
Protected method for plugging in a custom subclass of `RequestMappingHandlerMapping`.

Since:
  4.0

### getInterceptors

protected final Object[] getInterceptors(org.springframework.format.support.FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider)
Provide access to the shared handler interceptors used to configure `HandlerMapping` instances with.

This method cannot be overridden; use `addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry)` instead.

### addInterceptors

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

See Also:
  - `InterceptorRegistry`

### getPathMatchConfigurer

protected PathMatchConfigurer getPathMatchConfigurer()
Callback for building the `PathMatchConfigurer`. Delegates to `configurePathMatch(org.springframework.web.servlet.config.annotation.PathMatchConfigurer)`.

Since:
  4.1

### configurePathMatch

protected void configurePathMatch(PathMatchConfigurer configurer)
Override this method to configure path matching options.

Since:
  4.0.3
See Also:
  - `PathMatchConfigurer`

### mvcPatternParser

@Bean public org.springframework.web.util.pattern.PathPatternParser mvcPatternParser()
Return a global `PathPatternParser` instance to use for parsing patterns to match to the `RequestPath`. The returned instance can be configured using `configurePathMatch(PathMatchConfigurer)`.

Since:
  5.3.4

### mvcUrlPathHelper

@Bean public org.springframework.web.util.UrlPathHelper mvcUrlPathHelper()
Return a global `UrlPathHelper` instance which is used to resolve the request mapping path for an application. The instance can be configured via `configurePathMatch(PathMatchConfigurer)`.

Note: This is only used when parsed patterns are not `enabled`.

Since:
  4.1

### mvcPathMatcher

@Bean public org.springframework.util.PathMatcher mvcPathMatcher()
Return a global `PathMatcher` instance which is used for URL path matching with String patterns. The returned instance can be configured using `configurePathMatch(PathMatchConfigurer)`.

Note: This is only used when parsed patterns are not `enabled`.

Since:
  4.1

### mvcContentNegotiationManager

@Bean public org.springframework.web.accept.ContentNegotiationManager mvcContentNegotiationManager()
Return a `ContentNegotiationManager` instance to use to determine requested media types in a given request.

### getDefaultMediaTypes

protected Map<String,org.springframework.http.MediaType> getDefaultMediaTypes()

### configureContentNegotiation

protected void configureContentNegotiation(ContentNegotiationConfigurer configurer)
Override this method to configure content negotiation.

See Also:
  - `DefaultServletHandlerConfigurer`

### viewControllerHandlerMapping

@Bean @Nullable public HandlerMapping viewControllerHandlerMapping(@Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider)
Return a handler mapping ordered at 1 to map URL paths directly to view names. To configure view controllers, override `addViewControllers(org.springframework.web.servlet.config.annotation.ViewControllerRegistry)`.

### addViewControllers

protected void addViewControllers(ViewControllerRegistry registry)
Override this method to add view controllers.

See Also:
  - `ViewControllerRegistry`

### beanNameHandlerMapping

@Bean public BeanNameUrlHandlerMapping beanNameHandlerMapping(@Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider)
Return a `BeanNameUrlHandlerMapping` ordered at 2 to map URL paths to controller bean names.

### routerFunctionMapping

@Bean public RouterFunctionMapping routerFunctionMapping(@Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider)
Return a `RouterFunctionMapping` ordered at -1 to map router functions. Consider overriding one of these other more fine-grained methods:

- `addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry)` for adding handler interceptors.
- `addCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry)` to configure cross origin requests processing.
- `configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)` for adding custom message converters.
- `configurePathMatch(PathMatchConfigurer)` for customizing the `PathPatternParser`.

Since:
  5.2

### resourceHandlerMapping

@Bean @Nullable public HandlerMapping resourceHandlerMapping(@Qualifier("mvcContentNegotiationManager") org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, @Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider)
Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers. To configure resource handling, override `addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry)`.

### addResourceHandlers

protected void addResourceHandlers(ResourceHandlerRegistry registry)
Override this method to add resource handlers for serving static resources.

See Also:
  - `ResourceHandlerRegistry`

### mvcResourceUrlProvider

@Bean public ResourceUrlProvider mvcResourceUrlProvider()
A `ResourceUrlProvider` bean for use with the MVC dispatcher.

Since:
  4.1

### defaultServletHandlerMapping

@Bean @Nullable public HandlerMapping defaultServletHandlerMapping()
Return a handler mapping ordered at Integer.MAX_VALUE with a mapped default servlet handler. To configure "default" Servlet handling, override `configureDefaultServletHandling(org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer)`.

### configureDefaultServletHandling

protected void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Override this method to configure "default" Servlet handling.

See Also:
  - `DefaultServletHandlerConfigurer`

### requestMappingHandlerAdapter

@Bean public RequestMappingHandlerAdapter requestMappingHandlerAdapter(@Qualifier("mvcContentNegotiationManager") org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, @Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("mvcValidator") org.springframework.validation.Validator validator)
Returns a `RequestMappingHandlerAdapter` for processing requests through annotated controller methods. Consider overriding one of these other more fine-grained methods:

- `addArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>)` for adding custom argument resolvers.
- `addReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>)` for adding custom return value handlers.
- `configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)` for adding custom message converters.

### createRequestMappingHandlerAdapter

protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter()
Protected method for plugging in a custom subclass of `RequestMappingHandlerAdapter`.

Since:
  4.3

### handlerFunctionAdapter

@Bean public HandlerFunctionAdapter handlerFunctionAdapter()
Returns a `HandlerFunctionAdapter` for processing requests through handler functions.

Since:
  5.2

### getConfigurableWebBindingInitializer

protected org.springframework.web.bind.support.ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(org.springframework.format.support.FormattingConversionService mvcConversionService, org.springframework.validation.Validator mvcValidator)
Return the `ConfigurableWebBindingInitializer` to use for initializing all `WebDataBinder` instances.

### getMessageCodesResolver

@Nullable protected org.springframework.validation.MessageCodesResolver getMessageCodesResolver()
Override this method to provide a custom `MessageCodesResolver`.

### mvcConversionService

@Bean public org.springframework.format.support.FormattingConversionService mvcConversionService()
Return a `FormattingConversionService` for use with annotated controllers.

See `addFormatters(org.springframework.format.FormatterRegistry)` as an alternative to overriding this method.

### addFormatters

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

See Also:
  - `mvcConversionService()`

### mvcValidator

@Bean public org.springframework.validation.Validator mvcValidator()
Return a global `Validator` instance for example for validating `@ModelAttribute` and `@RequestBody` method arguments. Delegates to `getValidator()` first and if that returns `null` checks the classpath for the presence of a JSR-303 implementations before creating a `OptionalValidatorFactoryBean`.If a JSR-303 implementation is not available, a no-op `Validator` is returned.

### getValidator

@Nullable protected org.springframework.validation.Validator getValidator()
Override this method to provide a custom `Validator`.

### getArgumentResolvers

protected final List<org.springframework.web.method.support.HandlerMethodArgumentResolver> getArgumentResolvers()
Provide access to the shared custom argument resolvers used by the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver`.

This method cannot be overridden; use `addArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>)` instead.

Since:
  4.3

### addArgumentResolvers

protected void addArgumentResolvers(List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
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.

Parameters:
  `argumentResolvers` - the list of custom converters (initially an empty list)

### getReturnValueHandlers

protected final List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> getReturnValueHandlers()
Provide access to the shared return value handlers used by the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver`.

This method cannot be overridden; use `addReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>)` instead.

Since:
  4.3

### addReturnValueHandlers

protected void addReturnValueHandlers(List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
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.

Parameters:
  `returnValueHandlers` - the list of custom handlers (initially an empty list)

### getMessageConverters

protected final List<org.springframework.http.converter.HttpMessageConverter<?>> getMessageConverters()
Provides access to the shared `HttpMessageConverters` used by the `RequestMappingHandlerAdapter` and the `ExceptionHandlerExceptionResolver`.

This method cannot be overridden; use `configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)` instead. Also see `addDefaultHttpMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)` for adding default message converters.

### configureMessageConverters

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

Adding converters to the list turns off the default converters that would otherwise be registered by default. Also see `addDefaultHttpMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)` for adding default message converters.

Parameters:
  `converters` - a list to add message converters to (initially an empty list)

### extendMessageConverters

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. This may be useful for example to allow default converters to be registered and then insert a custom converter through this method.

Parameters:
  `converters` - the list of configured converters to extend
Since:
  4.1.3

### addDefaultHttpMessageConverters

protected final void addDefaultHttpMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
Adds a set of default HttpMessageConverter instances to the given list. Subclasses can call this method from `configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)`.

Parameters:
  `messageConverters` - the list to add the default message converters to

### getAsyncSupportConfigurer

protected AsyncSupportConfigurer getAsyncSupportConfigurer()
Callback for building the `AsyncSupportConfigurer`. Delegates to `configureAsyncSupport(AsyncSupportConfigurer)`.

Since:
  5.3.2

### configureAsyncSupport

protected void configureAsyncSupport(AsyncSupportConfigurer configurer)
Override this method to configure asynchronous request processing options.

See Also:
  - `AsyncSupportConfigurer`

### mvcUriComponentsContributor

@Bean public org.springframework.web.method.support.CompositeUriComponentsContributor mvcUriComponentsContributor(@Qualifier("mvcConversionService") org.springframework.format.support.FormattingConversionService conversionService, @Qualifier("requestMappingHandlerAdapter") RequestMappingHandlerAdapter requestMappingHandlerAdapter)
Return an instance of `CompositeUriComponentsContributor` for use with `MvcUriComponentsBuilder`.

Since:
  4.0

### httpRequestHandlerAdapter

@Bean public HttpRequestHandlerAdapter httpRequestHandlerAdapter()
Returns a `HttpRequestHandlerAdapter` for processing requests with `HttpRequestHandlers`.

### simpleControllerHandlerAdapter

@Bean public SimpleControllerHandlerAdapter simpleControllerHandlerAdapter()
Returns a `SimpleControllerHandlerAdapter` for processing requests with interface-based controllers.

### handlerExceptionResolver

@Bean public HandlerExceptionResolver handlerExceptionResolver(@Qualifier("mvcContentNegotiationManager") org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)
Returns a `HandlerExceptionResolverComposite` containing a list of exception resolvers obtained either through `configureHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)` or through `addDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>, org.springframework.web.accept.ContentNegotiationManager)`.

Note: This method cannot be made final due to CGLIB constraints. Rather than overriding it, consider overriding `configureHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)` which allows for providing a list of resolvers.

### configureHandlerExceptionResolvers

protected void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
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 `addDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>, org.springframework.web.accept.ContentNegotiationManager)` that can be used to add the default exception resolvers.

Parameters:
  `exceptionResolvers` - a list to add exception resolvers to (initially an empty list)

### extendHandlerExceptionResolvers

protected void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
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.

Parameters:
  `exceptionResolvers` - the list of configured resolvers to extend.
Since:
  4.3

### addDefaultHandlerExceptionResolvers

protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers, org.springframework.web.accept.ContentNegotiationManager mvcContentNegotiationManager)
A method available to subclasses for adding default `HandlerExceptionResolvers`.

Adds the following exception resolvers:

- `ExceptionHandlerExceptionResolver` for handling exceptions through `ExceptionHandler` methods.
- `ResponseStatusExceptionResolver` for exceptions annotated with `ResponseStatus`.
- `DefaultHandlerExceptionResolver` for resolving known Spring exception types

### createExceptionHandlerExceptionResolver

protected ExceptionHandlerExceptionResolver createExceptionHandlerExceptionResolver()
Protected method for plugging in a custom subclass of `ExceptionHandlerExceptionResolver`.

Since:
  4.3

### getErrorResponseInterceptors

protected final List<org.springframework.web.ErrorResponse.Interceptor> getErrorResponseInterceptors()
Provide access to the list of `ErrorResponse.Interceptor`'s to apply when rendering error responses.

This method cannot be overridden; use `configureErrorResponseInterceptors(List)` instead.

Since:
  6.2

### configureErrorResponseInterceptors

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.

Parameters:
  `interceptors` - the list to add handlers to
Since:
  6.2

### mvcViewResolver

@Bean public ViewResolver mvcViewResolver(@Qualifier("mvcContentNegotiationManager") org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)
Register a `ViewResolverComposite` that contains a chain of view resolvers to use for view resolution. By default, this resolver is ordered at 0 unless content negotiation view resolution is used in which case the order is raised to `Ordered.HIGHEST_PRECEDENCE`.

If no other resolvers are configured, `ViewResolverComposite.resolveViewName(String, Locale)` returns null in order to allow other potential `ViewResolver` beans to resolve views.

Since:
  4.1

### configureViewResolvers

protected void configureViewResolvers(ViewResolverRegistry registry)
Override this method to configure view resolution.

See Also:
  - `ViewResolverRegistry`

### getCorsConfigurations

protected final Map<String,org.springframework.web.cors.CorsConfiguration> getCorsConfigurations()
Return the registered `CorsConfiguration` objects, keyed by path pattern.

Since:
  4.2

### addCorsMappings

protected void addCorsMappings(CorsRegistry registry)
Override this method to configure cross-origin requests processing.

Since:
  4.2
See Also:
  - `CorsRegistry`

### mvcHandlerMappingIntrospector

@Bean @Lazy public HandlerMappingIntrospector mvcHandlerMappingIntrospector()

### localeResolver

@Bean public LocaleResolver localeResolver()

### themeResolver

@Bean @Deprecated public ThemeResolver themeResolver()
Deprecated.

### flashMapManager

@Bean public FlashMapManager flashMapManager()

### viewNameTranslator

@Bean public RequestToViewNameTranslator viewNameTranslator()