Class DelegatingWebMvcConfiguration
- All Implemented Interfaces:
Aware
,ApplicationContextAware
,ServletContextAware
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addArgumentResolvers
(List<HandlerMethodArgumentResolver> argumentResolvers) Add customHandlerMethodArgumentResolvers
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 customConverter
and/orFormatter
delegates to the commonFormattingConversionService
.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 customHandlerMethodReturnValueHandlers
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
Override this method to configure content negotiation.protected void
Override this method to configure "default" Servlet handling.protected void
configureErrorResponseInterceptors
(List<ErrorResponse.Interceptor> interceptors) Override this method for control over theErrorResponse.Interceptor
's to apply when rendering error responses.protected void
configureHandlerExceptionResolvers
(List<HandlerExceptionResolver> exceptionResolvers) Override this method to configure the list ofHandlerExceptionResolvers
to use.protected void
configureMessageConverters
(List<HttpMessageConverter<?>> converters) Override this method to add customHttpMessageConverters
to use with theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.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 ofHandlerExceptionResolvers
after it has been configured.protected void
extendMessageConverters
(List<HttpMessageConverter<?>> converters) Override this method to extend or modify the list of converters after it has been configured.protected MessageCodesResolver
Override this method to provide a customMessageCodesResolver
.protected Validator
Override this method to provide a customValidator
.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
-
Constructor Details
-
DelegatingWebMvcConfiguration
public DelegatingWebMvcConfiguration()
-
-
Method Details
-
setConfigurers
-
configurePathMatch
Description copied from class:WebMvcConfigurationSupport
Override this method to configure path matching options.- Overrides:
configurePathMatch
in classWebMvcConfigurationSupport
- See Also:
-
configureContentNegotiation
Description copied from class:WebMvcConfigurationSupport
Override this method to configure content negotiation.- Overrides:
configureContentNegotiation
in classWebMvcConfigurationSupport
- See Also:
-
configureAsyncSupport
Description copied from class:WebMvcConfigurationSupport
Override this method to configure asynchronous request processing options.- Overrides:
configureAsyncSupport
in classWebMvcConfigurationSupport
- See Also:
-
configureDefaultServletHandling
Description copied from class:WebMvcConfigurationSupport
Override this method to configure "default" Servlet handling.- Overrides:
configureDefaultServletHandling
in classWebMvcConfigurationSupport
- See Also:
-
addFormatters
Description copied from class:WebMvcConfigurationSupport
Override this method to add customConverter
and/orFormatter
delegates to the commonFormattingConversionService
.- Overrides:
addFormatters
in classWebMvcConfigurationSupport
- See Also:
-
addInterceptors
Description copied from class:WebMvcConfigurationSupport
Override this method to add Spring MVC interceptors for pre- and post-processing of controller invocation.- Overrides:
addInterceptors
in classWebMvcConfigurationSupport
- See Also:
-
addResourceHandlers
Description copied from class:WebMvcConfigurationSupport
Override this method to add resource handlers for serving static resources.- Overrides:
addResourceHandlers
in classWebMvcConfigurationSupport
- See Also:
-
addCorsMappings
Description copied from class:WebMvcConfigurationSupport
Override this method to configure cross-origin requests processing.- Overrides:
addCorsMappings
in classWebMvcConfigurationSupport
- See Also:
-
addViewControllers
Description copied from class:WebMvcConfigurationSupport
Override this method to add view controllers.- Overrides:
addViewControllers
in classWebMvcConfigurationSupport
- See Also:
-
configureViewResolvers
Description copied from class:WebMvcConfigurationSupport
Override this method to configure view resolution.- Overrides:
configureViewResolvers
in classWebMvcConfigurationSupport
- See Also:
-
addArgumentResolvers
Description copied from class:WebMvcConfigurationSupport
Add customHandlerMethodArgumentResolvers
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 theRequestMappingHandlerAdapter
directly.- Overrides:
addArgumentResolvers
in classWebMvcConfigurationSupport
- Parameters:
argumentResolvers
- the list of custom converters (initially an empty list)
-
addReturnValueHandlers
Description copied from class:WebMvcConfigurationSupport
Add customHandlerMethodReturnValueHandlers
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 theRequestMappingHandlerAdapter
directly.- Overrides:
addReturnValueHandlers
in classWebMvcConfigurationSupport
- Parameters:
returnValueHandlers
- the list of custom handlers (initially an empty list)
-
configureMessageConverters
Description copied from class:WebMvcConfigurationSupport
Override this method to add customHttpMessageConverters
to use with theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.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 classWebMvcConfigurationSupport
- Parameters:
converters
- a list to add message converters to (initially an empty list)
-
extendMessageConverters
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 classWebMvcConfigurationSupport
- 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 ofHandlerExceptionResolvers
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 classWebMvcConfigurationSupport
- Parameters:
exceptionResolvers
- a list to add exception resolvers to (initially an empty list)
-
extendHandlerExceptionResolvers
Description copied from class:WebMvcConfigurationSupport
Override this method to extend or modify the list ofHandlerExceptionResolvers
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 classWebMvcConfigurationSupport
- Parameters:
exceptionResolvers
- the list of configured resolvers to extend.
-
configureErrorResponseInterceptors
Description copied from class:WebMvcConfigurationSupport
Override this method for control over theErrorResponse.Interceptor
's to apply when rendering error responses.- Overrides:
configureErrorResponseInterceptors
in classWebMvcConfigurationSupport
- Parameters:
interceptors
- the list to add handlers to
-
getValidator
Description copied from class:WebMvcConfigurationSupport
Override this method to provide a customValidator
.- Overrides:
getValidator
in classWebMvcConfigurationSupport
-
getMessageCodesResolver
Description copied from class:WebMvcConfigurationSupport
Override this method to provide a customMessageCodesResolver
.- Overrides:
getMessageCodesResolver
in classWebMvcConfigurationSupport
-