@ -46,51 +46,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
@@ -46,51 +46,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* /
public interface WebMvcConfigurer {
/ * *
* Add { @link Converter } s and { @link Formatter } s in addition to the ones
* registered by default .
* /
void addFormatters ( FormatterRegistry registry ) ;
/ * *
* Configure the { @link HttpMessageConverter } s to use for reading or writing
* to the body of the request or response . If no converters are added , a
* default list of converters is registered .
* < p > < strong > Note < / strong > that adding converters to the list , turns off
* default converter registration . To simply add a converter without impacting
* default registration , consider using the method
* { @link # extendMessageConverters ( java . util . List ) } instead .
* @param converters initially an empty list of converters
* /
void configureMessageConverters ( List < HttpMessageConverter < ? > > converters ) ;
/ * *
* A hook for extending or modifying 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 .
* @param converters the list of configured converters to extend .
* @since 4 . 1 . 3
* /
void extendMessageConverters ( List < HttpMessageConverter < ? > > converters ) ;
/ * *
* Provide a custom { @link Validator } instead of the one created by default .
* The default implementation , assuming JSR - 303 is on the classpath , is :
* { @link org . springframework . validation . beanvalidation . OptionalValidatorFactoryBean } .
* Leave the return value as { @code null } to keep the default .
* /
Validator getValidator ( ) ;
/ * *
* Configure content negotiation options .
* /
void configureContentNegotiation ( ContentNegotiationConfigurer configurer ) ;
/ * *
* Configure asynchronous request handling options .
* /
void configureAsyncSupport ( AsyncSupportConfigurer configurer ) ;
/ * *
* Helps with configuring HandlerMappings path matching options such as trailing slash match ,
* suffix registration , path matcher and path helper .
@ -105,40 +60,28 @@ public interface WebMvcConfigurer {
@@ -105,40 +60,28 @@ public interface WebMvcConfigurer {
void configurePathMatch ( PathMatchConfigurer configurer ) ;
/ * *
* Add resolvers to support custom controller method argument types .
* < p > This does not override the built - in support for resolving handler
* method arguments . To customize the built - in support for argument
* resolution , configure { @link RequestMappingHandlerAdapter } directly .
* @param argumentResolvers initially an empty list
* Configure content negotiation options .
* /
void addArgumentResolvers ( List < HandlerMethodArgumentResolver > argumentResolvers ) ;
void configureContentNegotiation ( ContentNegotiationConfigurer configurer ) ;
/ * *
* Add handlers to support custom controller method return value types .
* < p > 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 .
* @param returnValueHandlers initially an empty list
* Configure asynchronous request handling options .
* /
void addReturnValueHandlers ( List < HandlerMethodReturnValueHandler > returnValueHandlers ) ;
void configureAsyncSupport ( AsyncSupportConfigurer configurer ) ;
/ * *
* Configure the { @link HandlerExceptionResolver } s to handle unresolved
* controller exceptions . If no resolvers are added to the list , default
* exception resolvers are added instead .
* @param exceptionResolvers initially an empty list
* 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 { @link DispatcherServlet } is mapped to "/" thus overriding the
* Servlet container ' s default handling of static resources .
* /
void configureHandlerExceptionResolvers ( List < HandlerExceptionResolver > exceptionResolvers ) ;
void configureDefaultServletHandling ( DefaultServletHandlerConfigurer configurer ) ;
/ * *
* A hook for extending or modifying the list of
* { @link HandlerExceptionResolver } s 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 .
* @param exceptionResolvers the list of configured resolvers to extend .
* @since 4 . 3
* Add { @link Converter } s and { @link Formatter } s in addition to the ones
* registered by default .
* /
void extendHandlerExceptionResolvers ( List < HandlerExceptionResolver > exceptionResolvers ) ;
void addFormatters ( FormatterRegistry registry ) ;
/ * *
* Add Spring MVC lifecycle interceptors for pre - and post - processing of
@ -155,11 +98,17 @@ public interface WebMvcConfigurer {
@@ -155,11 +98,17 @@ public interface WebMvcConfigurer {
void addInterceptors ( InterceptorRegistry registry ) ;
/ * *
* Provide a custom { @link MessageCodesResolver } for building message code s
* from data binding and validation error codes . Leave the return value as
* { @code null } to keep the default .
* Add handlers to serve static resources such as images , js , and , cs s
* files from specific locations under web application root , the classpath ,
* and others .
* /
MessageCodesResolver getMessageCodesResolver ( ) ;
void addResourceHandlers ( ResourceHandlerRegistry registry ) ;
/ * *
* Configure cross origin requests processing .
* @since 4 . 2
* /
void addCorsMappings ( CorsRegistry registry ) ;
/ * *
* Configure simple automated controllers pre - configured with the response
@ -178,24 +127,74 @@ public interface WebMvcConfigurer {
@@ -178,24 +127,74 @@ public interface WebMvcConfigurer {
void configureViewResolvers ( ViewResolverRegistry registry ) ;
/ * *
* Add handlers to serve static resources such as images , js , and , css
* files from specific locations under web application root , the classpath ,
* and others .
* Add resolvers to support custom controller method argument types .
* < p > This does not override the built - in support for resolving handler
* method arguments . To customize the built - in support for argument
* resolution , configure { @link RequestMappingHandlerAdapter } directly .
* @param argumentResolvers initially an empty list
* /
void addResourceHandlers ( ResourceHandlerRegistry registry ) ;
void addArgument Resolv ers ( List < HandlerMethodArgumentResolver > argumentResolvers ) ;
/ * *
* 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 { @link DispatcherServlet } is mapped to "/" thus overriding the
* Servlet container ' s default handling of static resources .
* Add handlers to support custom controller method return value types .
* < p > 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 .
* @param returnValueHandlers initially an empty list
* /
void configureDefaultServletHandling ( DefaultServletHandlerConfigurer configurer ) ;
void addReturnValueHandlers ( List < HandlerMethodReturnValueHandler > returnValueHandlers ) ;
/ * *
* Configure cross origin requests processing .
* @since 4 . 2
* Configure the { @link HttpMessageConverter } s to use for reading or writing
* to the body of the request or response . If no converters are added , a
* default list of converters is registered .
* < p > < strong > Note < / strong > that adding converters to the list , turns off
* default converter registration . To simply add a converter without impacting
* default registration , consider using the method
* { @link # extendMessageConverters ( java . util . List ) } instead .
* @param converters initially an empty list of converters
* /
void addCorsMappings ( CorsRegistry registry ) ;
void configureMessageConverters ( List < HttpMessageConverter < ? > > converters ) ;
/ * *
* A hook for extending or modifying 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 .
* @param converters the list of configured converters to extend .
* @since 4 . 1 . 3
* /
void extendMessageConverters ( List < HttpMessageConverter < ? > > converters ) ;
/ * *
* Configure the { @link HandlerExceptionResolver } s to handle unresolved
* controller exceptions . If no resolvers are added to the list , default
* exception resolvers are added instead .
* @param exceptionResolvers initially an empty list
* /
void configureHandlerExceptionResolvers ( List < HandlerExceptionResolver > exceptionResolvers ) ;
/ * *
* A hook for extending or modifying the list of { @link HandlerExceptionResolver } s
* 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 .
* @param exceptionResolvers the list of configured resolvers to extend
* @since 4 . 3
* /
void extendHandlerExceptionResolvers ( List < HandlerExceptionResolver > exceptionResolvers ) ;
/ * *
* Provide a custom { @link Validator } instead of the one created by default .
* The default implementation , assuming JSR - 303 is on the classpath , is :
* { @link org . springframework . validation . beanvalidation . OptionalValidatorFactoryBean } .
* Leave the return value as { @code null } to keep the default .
* /
Validator getValidator ( ) ;
/ * *
* Provide a custom { @link MessageCodesResolver } for building message codes
* from data binding and validation error codes . Leave the return value as
* { @code null } to keep the default .
* /
MessageCodesResolver getMessageCodesResolver ( ) ;
}