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
Constructors -
Method summary
Modifier and TypeMethodDescriptionprotected voidaddArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) Add customHandlerMethodArgumentResolversto use in addition to the ones registered by default.protected voidaddCorsMappings(CorsRegistry registry) Override this method to configure cross-origin requests processing.protected voidaddFormatters(FormatterRegistry registry) Override this method to add customConverterand/orFormatterdelegates to the commonFormattingConversionservice.protected voidaddInterceptors(InterceptorRegistry registry) Override this method to add spring MVC interceptors for pre- and post-processing of controller invocation.protected voidaddResourceHandlers(ResourceHandlerRegistry registry) Override this method to add resource handlers for serving static resources.protected voidaddReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) Add customHandlerMethodReturnValueHandlersin addition to the ones registered by default.protected voidaddViewControllers(ViewControllerRegistry registry) Override this method to add view controllers.protected voidconfigureApiVersioning(ApiVersionConfigurer configurer) Override this method to configure API versioning.protected voidconfigureAsyncsupport(AsyncsupportConfigurer configurer) Override this method to configure asynchronous request processing options.protected voidconfigureContentNegotiation(ContentNegotiationConfigurer configurer) Override this method to configure content negotiation.protected voidconfigureDefaultservletHandling(DefaultservletHandlerConfigurer configurer) Override this method to configure "default" servlet handling.protected voidconfigureErrorResponseInterceptors(List<ErrorResponse.Interceptor> interceptors) Override this method for control over theErrorResponse.Interceptor's to apply when rendering error responses.protected voidconfigureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) Override this method to configure the list ofHandlerExceptionResolversto use.protected voidconfigureMessageConverters(List<HttpMessageConverter<?>> converters) Deprecated, for removal: This API element is subject to removal in a future version.protected voidOverride this method to configure the message converters on the givenbuilder.protected voidconfigurePathMatch(PathMatchConfigurer configurer) Override this method to configure path matching options.protected voidconfigureViewResolvers(ViewResolverRegistry registry) Override this method to configure view resolution.protected voidextendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) Override this method to extend or modify the list ofHandlerExceptionResolversafter it has been configured.protected voidextendMessageConverters(List<HttpMessageConverter<?>> converters) Deprecated, for removal: This API element is subject to removal in a future version.protected @Nullable MessageCodesResolverOverride this method to provide a customMessageCodesResolver.Override this method to provide a customValidator.voidsetConfigurers(List<WebMvcConfigurer> configurers) Methods inherited from class WebMvcConfigurationsupport
addDefaultHandlerExceptionResolvers, addDefaultHttpMessageConverters, beanNameHandlerMapping, createExceptionHandlerExceptionResolver, createMessageConverters, createRequestMappingHandlerAdapter, createRequestMappingHandlerMapping, defaultservletHandlerMapping, flashMapManager, getApplicationContext, getArgumentResolvers, getAsyncsupportConfigurer, getConfigurableWebBindingInitializer, getCorsConfigurations, getDefaultMediaTypes, getErrorResponseInterceptors, getInterceptors, getMessageConverters, getPathMatchConfigurer, getReturnValueHandlers, getservletContext, handlerExceptionResolver, handlerFunctionAdapter, httpRequestHandlerAdapter, localeResolver, mvcApiVersionstrategy, mvcContentNegotiationManager, mvcConversionservice, mvcHandlerMappingIntrospector, mvcPathMatcher, mvcPatternParser, mvcResourceUrlProvider, mvcUriComponentsContributor, mvcUrlPathHelper, mvcValidator, mvcViewResolver, requestMappingHandlerAdapter, requestMappingHandlerMapping, resourceHandlerMapping, routerFunctionMapping, setApplicationContext, setservletContext, simpleControllerHandlerAdapter, viewControllerHandlerMapping, viewNameTranslator
-
Constructor Details
-
DelegatingWebMvcConfiguration
public DelegatingWebMvcConfiguration()
-
-
Method Details
-
setConfigurers
@Autowired(required=false) public void setConfigurers(List<WebMvcConfigurer> configurers) -
configurePathMatch
Description copied from class: WebMvcConfigurationsupportOverride this method to configure path matching options.- Overrides:
configurePathMatch in class WebMvcConfigurationsupport- see Also:
-
configureContentNegotiation
Description copied from class: WebMvcConfigurationsupportOverride this method to configure content negotiation.- Overrides:
configureContentNegotiation in class WebMvcConfigurationsupport- see Also:
-
configureApiVersioning
Description copied from class: WebMvcConfigurationsupportOverride this method to configure API versioning.- Overrides:
configureApiVersioning in class WebMvcConfigurationsupport
-
configureAsyncsupport
Description copied from class: WebMvcConfigurationsupportOverride this method to configure asynchronous request processing options.- Overrides:
configureAsyncsupport in class WebMvcConfigurationsupport- see Also:
-
configureDefaultservletHandling
protected void configureDefaultservletHandling(DefaultservletHandlerConfigurer configurer) Description copied from class: WebMvcConfigurationsupportOverride this method to configure "default" servlet handling.- Overrides:
configureDefaultservletHandling in class WebMvcConfigurationsupport- see Also:
-
addFormatters
Description copied from class: WebMvcConfigurationsupportOverride this method to add customConverterand/orFormatterdelegates to the commonFormattingConversionservice.- Overrides:
addFormatters in class WebMvcConfigurationsupport- see Also:
-
addInterceptors
Description copied from class: WebMvcConfigurationsupportOverride this method to add spring MVC interceptors for pre- and post-processing of controller invocation.- Overrides:
addInterceptors in class WebMvcConfigurationsupport- see Also:
-
addResourceHandlers
Description copied from class: WebMvcConfigurationsupportOverride this method to add resource handlers for serving static resources.- Overrides:
addResourceHandlers in class WebMvcConfigurationsupport- see Also:
-
addCorsMappings
Description copied from class: WebMvcConfigurationsupportOverride this method to configure cross-origin requests processing.- Overrides:
addCorsMappings in class WebMvcConfigurationsupport- see Also:
-
addViewControllers
Description copied from class: WebMvcConfigurationsupportOverride this method to add view controllers.- Overrides:
addViewControllers in class WebMvcConfigurationsupport- see Also:
-
configureViewResolvers
Description copied from class: WebMvcConfigurationsupportOverride this method to configure view resolution.- Overrides:
configureViewResolvers in class WebMvcConfigurationsupport- see Also:
-
addArgumentResolvers
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) Description copied from class: WebMvcConfigurationsupportAdd customHandlerMethodArgumentResolversto 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 theRequestMappingHandlerAdapterdirectly.- 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: WebMvcConfigurationsupportAdd customHandlerMethodReturnValueHandlersin 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 theRequestMappingHandlerAdapterdirectly.- Overrides:
addReturnValueHandlers in class WebMvcConfigurationsupport- Parameters:
returnValueHandlers- the list of custom handlers (initially an empty list)
-
configureMessageConverters
protected void configureMessageConverters(HttpMessageConverters.serverBuilder builder) Description copied from class: WebMvcConfigurationsupportOverride this method to configure the message converters on the givenbuilder.- Overrides:
configureMessageConverters in class WebMvcConfigurationsupport- Parameters:
builder- theHttpMessageConvertersbuilder to configure
-
configureMessageConverters
@Deprecated(since="7.0", forRemoval=true) protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class: WebMvcConfigurationsupportOverride this method to add custommesssage convertersto use with theRequestMappingHandlerAdapterand theExceptionHandlerExceptionResolver.Adding converters to the list turns off the default converters that would otherwise be registered by default. Also see
WebMvcConfigurationsupport.addDefaultHttpMessageConverters(List)for adding default message converters.- Overrides:
configureMessageConverters in class WebMvcConfigurationsupport- Parameters:
converters- a list to add message converters to (initially an empty list)
-
extendMessageConverters
@Deprecated(since="7.0", forRemoval=true) protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class: WebMvcConfigurationsupportOverride 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: WebMvcConfigurationsupportOverride this method to configure the list ofHandlerExceptionResolversto use.Adding resolvers to the list turns off the default resolvers that would otherwise be registered by default. Also see
WebMvcConfigurationsupport.addDefaultHandlerExceptionResolvers(List, 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: WebMvcConfigurationsupportOverride this method to extend or modify the list ofHandlerExceptionResolversafter 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<ErrorResponse.Interceptor> interceptors) Description copied from class: WebMvcConfigurationsupportOverride this method for control over theErrorResponse.Interceptor's to apply when rendering error responses.- Overrides:
configureErrorResponseInterceptors in class WebMvcConfigurationsupport- Parameters:
interceptors- the list to add handlers to
-
getValidator
Description copied from class: WebMvcConfigurationsupportOverride this method to provide a customValidator.- Overrides:
getValidator in class WebMvcConfigurationsupport
-
getMessageCodesResolver
Description copied from class: WebMvcConfigurationsupportOverride this method to provide a customMessageCodesResolver.- Overrides:
getMessageCodesResolver in class WebMvcConfigurationsupport
-