|
spring-webmvc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface WebMvcConfigurer
Defines callback methods to customize the Java-based configuration for
Spring MVC enabled via @EnableWebMvc
.
@EnableWebMvc
-annotated configuration classes may implement
this interface to be called back and given a chance to customize the
default configuration. Consider extending WebMvcConfigurerAdapter
,
which provides a stub implementation of all interface methods.
Method Summary | |
---|---|
void |
addArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
Add resolvers to support custom controller method argument types. |
void |
addFormatters(org.springframework.format.FormatterRegistry registry)
Add Converter s and Formatter s in addition to the ones
registered by default. |
void |
addInterceptors(InterceptorRegistry registry)
Add Spring MVC lifecycle interceptors for pre- and post-processing of controller method invocations. |
void |
addResourceHandlers(ResourceHandlerRegistry 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. |
void |
addReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
Add handlers to support custom controller method return value types. |
void |
addViewControllers(ViewControllerRegistry registry)
Add view controllers to create a direct mapping between a URL path and view name without the need for a controller in between. |
void |
configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet. |
void |
configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
Configure the HandlerExceptionResolver s to handle unresolved
controller exceptions. |
void |
configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
Configure the HttpMessageConverter s to use in argument resolvers
and return value handlers that support reading and/or writing to the
body of the request and response. |
org.springframework.validation.MessageCodesResolver |
getMessageCodesResolver()
Provide a custom MessageCodesResolver for building message codes
from data binding and validation error codes. |
org.springframework.validation.Validator |
getValidator()
Provide a custom Validator instead of the one created by default. |
Method Detail |
---|
void addFormatters(org.springframework.format.FormatterRegistry registry)
Converter
s and Formatter
s in addition to the ones
registered by default.
void configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
HttpMessageConverter
s to use in argument resolvers
and return value handlers that support reading and/or writing to the
body of the request and response. If no message converters are added to
the list, default converters are added instead.
converters
- initially an empty list of convertersorg.springframework.validation.Validator getValidator()
Validator
instead of the one created by default.
The default implementation, assuming JSR-303 is on the classpath, is:
LocalValidatorFactoryBean
.
Leave the return value as null
to keep the default.
void addArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
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.
argumentResolvers
- initially an empty listvoid addReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
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.
returnValueHandlers
- initially an empty listvoid configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
HandlerExceptionResolver
s to handle unresolved
controller exceptions. If no resolvers are added to the list, default
exception resolvers are added instead.
exceptionResolvers
- initially an empty listvoid addInterceptors(InterceptorRegistry registry)
org.springframework.validation.MessageCodesResolver getMessageCodesResolver()
MessageCodesResolver
for building message codes
from data binding and validation error codes. Leave the return value as
null
to keep the default.
void addViewControllers(ViewControllerRegistry registry)
void addResourceHandlers(ResourceHandlerRegistry registry)
void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
DispatcherServlet
is mapped to "/" thus overriding the
Servlet container's default handling of static resources.
|
spring-webmvc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |