Top Description Fields Constructors Methods
org.springframework.web.servlet.config.annotation

pack-priv Class WebMvcConfigurerComposite

extends Object
implements WebMvcConfigurer
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Imports
java.util.ArrayList, .List, org.springframework.format.FormatterRegistry, org.springframework.http.converter.HttpMessageConverter, org.springframework.lang.Nullable, org.springframework.util.CollectionUtils, org.springframework.validation.MessageCodesResolver, .Validator, org.springframework.web.method.support.HandlerMethodArgumentResolver, .HandlerMethodReturnValueHandler, org.springframework.web.servlet.HandlerExceptionResolver

A WebMvcConfigurer that delegates to one or more others.
Author
Rossen Stoyanchev
Since
3.1

Field Summary

Modifier and TypeField and Description
private final List<WebMvcConfigurer>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addArgumentResolvers(List<HandlerMethodArgumentResolver>
initially an empty list
argumentResolvers
)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addArgumentResolvers.

Add resolvers to support custom controller method argument types.

public void
addCorsMappings(CorsRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addCorsMappings.

Configure "global" cross-origin request processing.

public void
addFormatters(FormatterRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addFormatters.

Add Converters and Formatters in addition to the ones registered by default.

public void
addInterceptors(InterceptorRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addInterceptors.

Add Spring MVC lifecycle interceptors for pre- and post-processing of controller method invocations and resource handler requests.

public void
addResourceHandlers(ResourceHandlerRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addResourceHandlers.

Add handlers to serve static resources such as images, js, and, css files from specific locations under web application root, the classpath, and others.

public void
addReturnValueHandlers(List<HandlerMethodReturnValueHandler>
initially an empty list
returnValueHandlers
)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addReturnValueHandlers.

Add handlers to support custom controller method return value types.

public void
addViewControllers(ViewControllerRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addViewControllers.

Configure simple automated controllers pre-configured with the response status code and/or a view to render the response body.

public void
public void
public void
public void
configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureDefaultServletHandling.

Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet.

public void
public void
configureMessageConverters(List<HttpMessageConverter<?>>
initially an empty list of converters
converters
)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureMessageConverters.

Configure the HttpMessageConverters for reading from the request body and for writing to the response body.

public void
configurePathMatch(PathMatchConfigurer configurer)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configurePathMatch.

Help with configuring HandlerMapping path matching options such as whether to use parsed PathPatterns or String pattern matching with PathMatcher, whether to match trailing slashes, and more.

public void
configureViewResolvers(ViewResolverRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureViewResolvers.

Configure view resolvers to translate String-based view names returned from controllers into concrete org.springframework.web.servlet.View implementations to perform rendering with.

public void
extendHandlerExceptionResolvers(List<HandlerExceptionResolver>
the list of configured resolvers to extend
exceptionResolvers
)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendHandlerExceptionResolvers.

Extending or modify the list of exception resolvers configured by default.

public void
extendMessageConverters(List<HttpMessageConverter<?>>
the list of configured converters to be extended
converters
)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendMessageConverters.

Extend or modify the list of converters after it has been, either configured or initialized with a default list.

public MessageCodesResolver
getMessageCodesResolver()

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.getMessageCodesResolver.

Provide a custom MessageCodesResolver for building message codes from data binding and validation error codes.

public Validator
getValidator()

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.getValidator.

Provide a custom Validator instead of the one created by default.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegatesback to summary
private final List<WebMvcConfigurer> delegates

Constructor Detail

WebMvcConfigurerCompositeback to summary
pack-priv WebMvcConfigurerComposite()

Method Detail

addArgumentResolversback to summary
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addArgumentResolvers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addArgumentResolvers.

Add resolvers to support custom controller method argument types.

This does not override the built-in support for resolving handler method arguments. To customize the built-in support for argument resolution, configure RequestMappingHandlerAdapter directly.

Parameters
argumentResolvers:List<HandlerMethodArgumentResolver>

initially an empty list

Annotations
@Override
addCorsMappingsback to summary
public void addCorsMappings(CorsRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addCorsMappings.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addCorsMappings.

Configure "global" cross-origin request processing. The configured CORS mappings apply to annotated controllers, functional endpoints, and static resources.

Annotated controllers can further declare more fine-grained config via @CrossOrigin. In such cases "global" CORS configuration declared here is combined with local CORS configuration defined on a controller method.

Annotations
@Override
addFormattersback to summary
public void addFormatters(FormatterRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addFormatters.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addFormatters.

Add Converters and Formatters in addition to the ones registered by default.

Annotations
@Override
addInterceptorsback to summary
public void addInterceptors(InterceptorRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addInterceptors.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addInterceptors.

Add Spring MVC lifecycle interceptors for pre- and post-processing of controller method invocations and resource handler requests. Interceptors can be registered to apply to all requests or be limited to a subset of URL patterns.

Annotations
@Override
addResourceHandlersback to summary
public void addResourceHandlers(ResourceHandlerRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addResourceHandlers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addResourceHandlers.

Add handlers to serve static resources such as images, js, and, css files from specific locations under web application root, the classpath, and others.

Annotations
@Override
addReturnValueHandlersback to summary
public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addReturnValueHandlers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addReturnValueHandlers.

Add handlers to support custom controller method return value types.

Using this option does not override the built-in support for handling return values. To customize the built-in support for handling return values, configure RequestMappingHandlerAdapter directly.

Parameters
returnValueHandlers:List<HandlerMethodReturnValueHandler>

initially an empty list

Annotations
@Override
addViewControllersback to summary
public void addViewControllers(ViewControllerRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addViewControllers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.addViewControllers.

Configure simple automated controllers pre-configured with the response status code and/or a view to render the response body. This is useful in cases where there is no need for custom controller logic -- e.g. render a home page, perform simple site URL redirects, return a 404 status with HTML content, a 204 with no content, and more.

Annotations
@Override
addWebMvcConfigurersback to summary
public void addWebMvcConfigurers(List<WebMvcConfigurer> configurers)
configureAsyncSupportback to summary
public void configureAsyncSupport(AsyncSupportConfigurer configurer)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureAsyncSupport.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureAsyncSupport.

Configure asynchronous request handling options.

Annotations
@Override
configureContentNegotiationback to summary
public void configureContentNegotiation(ContentNegotiationConfigurer configurer)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureContentNegotiation.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureContentNegotiation.

Configure content negotiation options.

Annotations
@Override
configureDefaultServletHandlingback to summary
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureDefaultServletHandling.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureDefaultServletHandling.

Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet. A common use case for this is when the DispatcherServlet is mapped to "/" thus overriding the Servlet container's default handling of static resources.

Annotations
@Override
configureHandlerExceptionResolversback to summary
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureHandlerExceptionResolvers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureHandlerExceptionResolvers.

Configure exception resolvers.

The given list starts out empty. If it is left empty, the framework configures a default set of resolvers, see WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List, org.springframework.web.accept.ContentNegotiationManager). Or if any exception resolvers are added to the list, then the application effectively takes over and must provide, fully initialized, exception resolvers.

Alternatively you can use extendHandlerExceptionResolvers(List) which allows you to extend or modify the list of exception resolvers configured by default.

Parameters
exceptionResolvers:List<HandlerExceptionResolver>

initially an empty list

Annotations
@Override
configureMessageConvertersback to summary
public void configureMessageConverters(List<HttpMessageConverter<?>> converters)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureMessageConverters.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureMessageConverters.

Configure the HttpMessageConverters for reading from the request body and for writing to the response body.

By default, all built-in converters are configured as long as the corresponding 3rd party libraries such Jackson JSON, JAXB2, and others are present on the classpath.

Note that use of this method turns off default converter registration. However, in a Spring Boot application the WebMvcAutoConfiguration adds any HttpMessageConverter beans as well as default converters. Hence, in a Boot application use HttpMessageConverters. Alternatively, for any scenario, use extendMessageConverters(java.util.List) to modify the configured list of message converters.

Parameters
converters:List<HttpMessageConverter<?>>

initially an empty list of converters

Annotations
@Override
configurePathMatchback to summary
public void configurePathMatch(PathMatchConfigurer configurer)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configurePathMatch.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configurePathMatch.

Help with configuring HandlerMapping path matching options such as whether to use parsed PathPatterns or String pattern matching with PathMatcher, whether to match trailing slashes, and more.

Annotations
@Override
configureViewResolversback to summary
public void configureViewResolvers(ViewResolverRegistry registry)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureViewResolvers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.configureViewResolvers.

Configure view resolvers to translate String-based view names returned from controllers into concrete org.springframework.web.servlet.View implementations to perform rendering with.

Annotations
@Override
extendHandlerExceptionResolversback to summary
public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendHandlerExceptionResolvers.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendHandlerExceptionResolvers.

Extending or modify the list of exception resolvers configured by default. This can be useful for inserting a custom exception resolver without interfering with default ones.

Parameters
exceptionResolvers:List<HandlerExceptionResolver>

the list of configured resolvers to extend

Annotations
@Override
extendMessageConvertersback to summary
public void extendMessageConverters(List<HttpMessageConverter<?>> converters)

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendMessageConverters.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendMessageConverters.

Extend or modify the list of converters after it has been, either configured or initialized with a default list.

Note that the order of converter registration is important. Especially in cases where clients accept org.springframework.http.MediaType#ALL the converters configured earlier will be preferred.

Parameters
converters:List<HttpMessageConverter<?>>

the list of configured converters to be extended

Annotations
@Override
getMessageCodesResolverback to summary
public MessageCodesResolver getMessageCodesResolver()

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.getMessageCodesResolver.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.getMessageCodesResolver.

Provide a custom MessageCodesResolver for building message codes from data binding and validation error codes. Leave the return value as null to keep the default.

Annotations
@Override
@Nullable
getValidatorback to summary
public Validator getValidator()

Overrides default org.springframework.web.servlet.config.annotation.WebMvcConfigurer.getValidator.

Doc from org.springframework.web.servlet.config.annotation.WebMvcConfigurer.getValidator.

Provide a custom Validator instead of the one created by default. The default implementation, assuming JSR-303 is on the classpath, is: org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean. Leave the return value as null to keep the default.

Annotations
@Override