类 WebMvcConfigurerAdapter
- java.lang.Object
- org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
- 所有已实现的接口:
WebMvcConfigurer
@Deprecated public abstract class WebMvcConfigurerAdapter extends Object implements WebMvcConfigurer
已过时。as of 5.0WebMvcConfigurer
has default methods (made possible by a Java 8 baseline) and can be implemented directly without the need for this adapterAn implementation ofWebMvcConfigurer
with empty methods allowing subclasses to override only the methods they're interested in.- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 WebMvcConfigurerAdapter()
已过时。
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
已过时。Add resolvers to support custom controller method argument types.void
addCorsMappings(CorsRegistry registry)
已过时。Configure cross origin requests processing.void
addFormatters(FormatterRegistry registry)
已过时。AddConverters
andFormatters
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 and resource handler requests.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(List<HandlerMethodReturnValueHandler> returnValueHandlers)
已过时。Add handlers to support custom controller method return value types.void
addViewControllers(ViewControllerRegistry registry)
已过时。Configure simple automated controllers pre-configured with the response status code and/or a view to render the response body.void
configureAsyncSupport(AsyncSupportConfigurer configurer)
已过时。Configure asynchronous request handling options.void
configureContentNegotiation(ContentNegotiationConfigurer configurer)
已过时。Configure content negotiation options.void
configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
已过时。Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet.void
configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
已过时。Configure exception resolvers.void
configureMessageConverters(List<HttpMessageConverter<?>> converters)
已过时。Configure theHttpMessageConverters
to use for reading or writing to the body of the request or response.void
configurePathMatch(PathMatchConfigurer configurer)
已过时。Helps with configuring HandlerMappings path matching options such as trailing slash match, suffix registration, path matcher and path helper.void
configureViewResolvers(ViewResolverRegistry registry)
已过时。Configure view resolvers to translate String-based view names returned from controllers into concreteView
implementations to perform rendering with.void
extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
已过时。Extending or modify the list of exception resolvers configured by default.void
extendMessageConverters(List<HttpMessageConverter<?>> converters)
已过时。A hook for extending or modifying the list of converters after it has been configured.MessageCodesResolver
getMessageCodesResolver()
已过时。Provide a customMessageCodesResolver
for building message codes from data binding and validation error codes.Validator
getValidator()
已过时。Provide a customValidator
instead of the one created by default.
构造器详细资料
WebMvcConfigurerAdapter
public WebMvcConfigurerAdapter()
已过时。
方法详细资料
configurePathMatch
public void configurePathMatch(PathMatchConfigurer configurer)
已过时。Helps with configuring HandlerMappings path matching options such as trailing slash match, suffix registration, path matcher and path helper. Configured path matcher and path helper instances are shared for:- RequestMappings
- ViewControllerMappings
- ResourcesMappings
This implementation is empty.
- 指定者:
configurePathMatch
在接口中WebMvcConfigurer
configureContentNegotiation
public void configureContentNegotiation(ContentNegotiationConfigurer configurer)
已过时。Configure content negotiation options.This implementation is empty.
configureAsyncSupport
public void configureAsyncSupport(AsyncSupportConfigurer configurer)
已过时。Configure asynchronous request handling options.This implementation is empty.
- 指定者:
configureAsyncSupport
在接口中WebMvcConfigurer
configureDefaultServletHandling
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
已过时。Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet. A common use case for this is when theDispatcherServlet
is mapped to "/" thus overriding the Servlet container's default handling of static resources.This implementation is empty.
addFormatters
public void addFormatters(FormatterRegistry registry)
已过时。AddConverters
andFormatters
in addition to the ones registered by default.This implementation is empty.
- 指定者:
addFormatters
在接口中WebMvcConfigurer
addInterceptors
public void addInterceptors(InterceptorRegistry registry)
已过时。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.This implementation is empty.
- 指定者:
addInterceptors
在接口中WebMvcConfigurer
addResourceHandlers
public 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.This implementation is empty.
- 指定者:
addResourceHandlers
在接口中WebMvcConfigurer
addCorsMappings
public void addCorsMappings(CorsRegistry registry)
已过时。Configure cross origin requests processing.This implementation is empty.
- 指定者:
addCorsMappings
在接口中WebMvcConfigurer
addViewControllers
public void addViewControllers(ViewControllerRegistry registry)
已过时。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.This implementation is empty.
- 指定者:
addViewControllers
在接口中WebMvcConfigurer
configureViewResolvers
public void configureViewResolvers(ViewResolverRegistry registry)
已过时。Configure view resolvers to translate String-based view names returned from controllers into concreteView
implementations to perform rendering with.This implementation is empty.
- 指定者:
configureViewResolvers
在接口中WebMvcConfigurer
addArgumentResolvers
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
已过时。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.This implementation is empty.
- 指定者:
addArgumentResolvers
在接口中WebMvcConfigurer
- 参数:
argumentResolvers
- initially an empty list
addReturnValueHandlers
public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
已过时。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.
This implementation is empty.
- 指定者:
addReturnValueHandlers
在接口中WebMvcConfigurer
- 参数:
returnValueHandlers
- initially an empty list
configureMessageConverters
public void configureMessageConverters(List<HttpMessageConverter<?>> converters)
已过时。Configure theHttpMessageConverters
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.Note that adding converters to the list, turns off default converter registration. To simply add a converter without impacting default registration, consider using the method
WebMvcConfigurer.extendMessageConverters(java.util.List)
instead.This implementation is empty.
- 指定者:
configureMessageConverters
在接口中WebMvcConfigurer
- 参数:
converters
- initially an empty list of converters
extendMessageConverters
public void extendMessageConverters(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.This implementation is empty.
- 指定者:
extendMessageConverters
在接口中WebMvcConfigurer
- 参数:
converters
- the list of configured converters to extend.
configureHandlerExceptionResolvers
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
已过时。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
WebMvcConfigurer.extendHandlerExceptionResolvers(List)
which allows you to extend or modify the list of exception resolvers configured by default.This implementation is empty.
- 指定者:
configureHandlerExceptionResolvers
在接口中WebMvcConfigurer
- 参数:
exceptionResolvers
- initially an empty list- 另请参阅:
WebMvcConfigurer.extendHandlerExceptionResolvers(List)
,WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(List, org.springframework.web.accept.ContentNegotiationManager)
extendHandlerExceptionResolvers
public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
已过时。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.This implementation is empty.
- 指定者:
extendHandlerExceptionResolvers
在接口中WebMvcConfigurer
- 参数:
exceptionResolvers
- the list of configured resolvers to extend- 另请参阅:
WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(List, org.springframework.web.accept.ContentNegotiationManager)
getValidator
@Nullable public Validator getValidator()
已过时。Provide a customValidator
instead of the one created by default. The default implementation, assuming JSR-303 is on the classpath, is:OptionalValidatorFactoryBean
. Leave the return value asnull
to keep the default.This implementation returns
null
.- 指定者:
getValidator
在接口中WebMvcConfigurer
getMessageCodesResolver
@Nullable public MessageCodesResolver getMessageCodesResolver()
已过时。Provide a customMessageCodesResolver
for building message codes from data binding and validation error codes. Leave the return value asnull
to keep the default.This implementation returns
null
.- 指定者:
getMessageCodesResolver
在接口中WebMvcConfigurer