类 WebMvcConfigurationSupport
- java.lang.Object
- org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
- 所有已实现的接口:
Aware
,ApplicationContextAware
,ServletContextAware
public class WebMvcConfigurationSupport extends Object implements ApplicationContextAware, ServletContextAware
This is the main class providing the configuration behind the MVC Java config. It is typically imported by adding@EnableWebMvc
to an application@Configuration
class. An alternative more advanced option is to extend directly from this class and override methods as necessary, remembering to add@Configuration
to the subclass and@Bean
to overridden@Bean
methods. For more details see the javadoc of@EnableWebMvc
.This class registers the following
HandlerMappings
:RequestMappingHandlerMapping
ordered at 0 for mapping requests to annotated controller methods.HandlerMapping
ordered at 1 to map URL paths directly to view names.BeanNameUrlHandlerMapping
ordered at 2 to map URL paths to controller bean names.HandlerMapping
ordered atInteger.MAX_VALUE-1
to serve static resource requests.HandlerMapping
ordered atInteger.MAX_VALUE
to forward requests to the default servlet.
Registers these
HandlerAdapters
:RequestMappingHandlerAdapter
for processing requests with annotated controller methods.HttpRequestHandlerAdapter
for processing requests withHttpRequestHandlers
.SimpleControllerHandlerAdapter
for processing requests with interface-basedControllers
.
Registers a
HandlerExceptionResolverComposite
with this chain of exception resolvers:ExceptionHandlerExceptionResolver
for handling exceptions throughExceptionHandler
methods.ResponseStatusExceptionResolver
for exceptions annotated withResponseStatus
.DefaultHandlerExceptionResolver
for resolving known Spring exception types
Registers an
AntPathMatcher
and aUrlPathHelper
to be used by:- the
RequestMappingHandlerMapping
, - the
HandlerMapping
for ViewControllers - and the
HandlerMapping
for serving resources
PathMatchConfigurer
.Both the
RequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
are configured with default instances of the following by default:- a
ContentNegotiationManager
- a
DefaultFormattingConversionService
- an
OptionalValidatorFactoryBean
if a JSR-303 implementation is available on the classpath - a range of
HttpMessageConverters
depending on the third-party libraries available on the classpath.
- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev, Brian Clozel, Sebastien Deleuze
- 另请参阅:
EnableWebMvc
,WebMvcConfigurer
,WebMvcConfigurerAdapter
构造器概要
构造器 构造器 说明 WebMvcConfigurationSupport()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected void
addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Add customHandlerMethodArgumentResolvers
to use in addition to the ones registered by default.protected void
addCorsMappings(CorsRegistry registry)
Override this method to configure cross origin requests processing.protected void
addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
A method available to subclasses for adding defaultHandlerExceptionResolvers
.protected void
addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Adds a set of default HttpMessageConverter instances to the given list.protected void
addFormatters(FormatterRegistry registry)
Override this method to add customConverter
and/orFormatter
delegates to the commonFormattingConversionService
.protected void
addInterceptors(InterceptorRegistry registry)
Override this method to add Spring MVC interceptors for pre- and post-processing of controller invocation.protected void
addResourceHandlers(ResourceHandlerRegistry registry)
Override this method to add resource handlers for serving static resources.protected void
addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
Add customHandlerMethodReturnValueHandlers
in addition to the ones registered by default.protected void
addViewControllers(ViewControllerRegistry registry)
Override this method to add view controllers.BeanNameUrlHandlerMapping
beanNameHandlerMapping()
Return aBeanNameUrlHandlerMapping
ordered at 2 to map URL paths to controller bean names.protected void
configureAsyncSupport(AsyncSupportConfigurer configurer)
Override this method to configure asynchronous request processing options.protected void
configureContentNegotiation(ContentNegotiationConfigurer configurer)
Override this method to configure content negotiation.protected void
configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Override this method to configure "default" Servlet handling.protected void
configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
Override this method to configure the list ofHandlerExceptionResolvers
to use.protected void
configureMessageConverters(List<HttpMessageConverter<?>> converters)
Override this method to add customHttpMessageConverters
to use with theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.protected void
configurePathMatch(PathMatchConfigurer configurer)
Override this method to configure path matching options.protected void
configureViewResolvers(ViewResolverRegistry registry)
Override this method to configure view resolution.protected ExceptionHandlerExceptionResolver
createExceptionHandlerExceptionResolver()
Protected method for plugging in a custom subclass ofExceptionHandlerExceptionResolver
.protected RequestMappingHandlerAdapter
createRequestMappingHandlerAdapter()
Protected method for plugging in a custom subclass ofRequestMappingHandlerAdapter
.protected RequestMappingHandlerMapping
createRequestMappingHandlerMapping()
Protected method for plugging in a custom subclass ofRequestMappingHandlerMapping
.HandlerMapping
defaultServletHandlerMapping()
Return a handler mapping ordered at Integer.MAX_VALUE with a mapped default servlet handler.protected void
extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
Override this method to extend or modify the list ofHandlerExceptionResolvers
after it has been configured.protected void
extendMessageConverters(List<HttpMessageConverter<?>> converters)
Override this method to extend or modify the list of converters after it has been configured.ApplicationContext
getApplicationContext()
Return the associated SpringApplicationContext
.protected List<HandlerMethodArgumentResolver>
getArgumentResolvers()
Provide access to the shared custom argument resolvers used by theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.protected ConfigurableWebBindingInitializer
getConfigurableWebBindingInitializer()
Return theConfigurableWebBindingInitializer
to use for initializing allWebDataBinder
instances.protected Map<String,CorsConfiguration>
getCorsConfigurations()
Return the registeredCorsConfiguration
objects, keyed by path pattern.protected Map<String,MediaType>
getDefaultMediaTypes()
protected Object[]
getInterceptors()
Provide access to the shared handler interceptors used to configureHandlerMapping
instances with.protected MessageCodesResolver
getMessageCodesResolver()
Override this method to provide a customMessageCodesResolver
.protected List<HttpMessageConverter<?>>
getMessageConverters()
Provides access to the sharedHttpMessageConverters
used by theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.protected PathMatchConfigurer
getPathMatchConfigurer()
Callback for building thePathMatchConfigurer
.protected List<HandlerMethodReturnValueHandler>
getReturnValueHandlers()
Provide access to the shared return value handlers used by theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.ServletContext
getServletContext()
Return the associatedServletContext
.protected Validator
getValidator()
Override this method to provide a customValidator
.HandlerExceptionResolver
handlerExceptionResolver()
Returns aHandlerExceptionResolverComposite
containing a list of exception resolvers obtained either throughconfigureHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
or throughaddDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
.HttpRequestHandlerAdapter
httpRequestHandlerAdapter()
Returns aHttpRequestHandlerAdapter
for processing requests withHttpRequestHandler
s.ContentNegotiationManager
mvcContentNegotiationManager()
Return aContentNegotiationManager
instance to use to determine requested media types in a given request.FormattingConversionService
mvcConversionService()
Return aFormattingConversionService
for use with annotated controllers.HandlerMappingIntrospector
mvcHandlerMappingIntrospector()
PathMatcher
mvcPathMatcher()
Return a globalPathMatcher
instance for path matching patterns inHandlerMappings
.ResourceUrlProvider
mvcResourceUrlProvider()
AResourceUrlProvider
bean for use with the MVC dispatcher.CompositeUriComponentsContributor
mvcUriComponentsContributor()
Return an instance ofCompositeUriComponentsContributor
for use withMvcUriComponentsBuilder
.UrlPathHelper
mvcUrlPathHelper()
Return a globalUrlPathHelper
instance for path matching patterns inHandlerMappings
.Validator
mvcValidator()
Return a globalValidator
instance for example for validating@ModelAttribute
and@RequestBody
method arguments.ViewResolver
mvcViewResolver()
Register aViewResolverComposite
that contains a chain of view resolvers to use for view resolution.RequestMappingHandlerAdapter
requestMappingHandlerAdapter()
Returns aRequestMappingHandlerAdapter
for processing requests through annotated controller methods.RequestMappingHandlerMapping
requestMappingHandlerMapping()
Return aRequestMappingHandlerMapping
ordered at 0 for mapping requests to annotated controllers.HandlerMapping
resourceHandlerMapping()
Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers.void
setApplicationContext(ApplicationContext applicationContext)
Set the SpringApplicationContext
, e.g. for resource loading.void
setServletContext(ServletContext servletContext)
Set theServletContext
, e.g. for resource handling, looking up file extensions, etc.SimpleControllerHandlerAdapter
simpleControllerHandlerAdapter()
Returns aSimpleControllerHandlerAdapter
for processing requests with interface-based controllers.HandlerMapping
viewControllerHandlerMapping()
Return a handler mapping ordered at 1 to map URL paths directly to view names.
构造器详细资料
WebMvcConfigurationSupport
public WebMvcConfigurationSupport()
方法详细资料
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
Set the SpringApplicationContext
, e.g. for resource loading.- 指定者:
setApplicationContext
在接口中ApplicationContextAware
- 参数:
applicationContext
- the ApplicationContext object to be used by this object- 另请参阅:
BeanInitializationException
getApplicationContext
public ApplicationContext getApplicationContext()
Return the associated SpringApplicationContext
.- 从以下版本开始:
- 4.2
setServletContext
public void setServletContext(ServletContext servletContext)
Set theServletContext
, e.g. for resource handling, looking up file extensions, etc.- 指定者:
setServletContext
在接口中ServletContextAware
- 参数:
servletContext
- ServletContext object to be used by this object- 另请参阅:
InitializingBean.afterPropertiesSet()
,ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
getServletContext
public ServletContext getServletContext()
Return the associatedServletContext
.- 从以下版本开始:
- 4.2
requestMappingHandlerMapping
@Bean public RequestMappingHandlerMapping requestMappingHandlerMapping()
Return aRequestMappingHandlerMapping
ordered at 0 for mapping requests to annotated controllers.
createRequestMappingHandlerMapping
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping()
Protected method for plugging in a custom subclass ofRequestMappingHandlerMapping
.- 从以下版本开始:
- 4.0
getInterceptors
protected final Object[] getInterceptors()
Provide access to the shared handler interceptors used to configureHandlerMapping
instances with.This method cannot be overridden; use
addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry)
instead.
addInterceptors
protected void addInterceptors(InterceptorRegistry registry)
Override this method to add Spring MVC interceptors for pre- and post-processing of controller invocation.- 另请参阅:
InterceptorRegistry
getPathMatchConfigurer
protected PathMatchConfigurer getPathMatchConfigurer()
Callback for building thePathMatchConfigurer
. Delegates toconfigurePathMatch(org.springframework.web.servlet.config.annotation.PathMatchConfigurer)
.- 从以下版本开始:
- 4.1
configurePathMatch
protected void configurePathMatch(PathMatchConfigurer configurer)
Override this method to configure path matching options.- 从以下版本开始:
- 4.0.3
- 另请参阅:
PathMatchConfigurer
mvcPathMatcher
@Bean public PathMatcher mvcPathMatcher()
Return a globalPathMatcher
instance for path matching patterns inHandlerMappings
. This instance can be configured using thePathMatchConfigurer
inconfigurePathMatch(PathMatchConfigurer)
.- 从以下版本开始:
- 4.1
mvcUrlPathHelper
@Bean public UrlPathHelper mvcUrlPathHelper()
Return a globalUrlPathHelper
instance for path matching patterns inHandlerMappings
. This instance can be configured using thePathMatchConfigurer
inconfigurePathMatch(PathMatchConfigurer)
.- 从以下版本开始:
- 4.1
mvcContentNegotiationManager
@Bean public ContentNegotiationManager mvcContentNegotiationManager()
Return aContentNegotiationManager
instance to use to determine requested media types in a given request.
getDefaultMediaTypes
protected Map<String,MediaType> getDefaultMediaTypes()
configureContentNegotiation
protected void configureContentNegotiation(ContentNegotiationConfigurer configurer)
Override this method to configure content negotiation.
viewControllerHandlerMapping
@Bean public HandlerMapping viewControllerHandlerMapping()
Return a handler mapping ordered at 1 to map URL paths directly to view names. To configure view controllers, overrideaddViewControllers(org.springframework.web.servlet.config.annotation.ViewControllerRegistry)
.
addViewControllers
protected void addViewControllers(ViewControllerRegistry registry)
Override this method to add view controllers.
beanNameHandlerMapping
@Bean public BeanNameUrlHandlerMapping beanNameHandlerMapping()
Return aBeanNameUrlHandlerMapping
ordered at 2 to map URL paths to controller bean names.
resourceHandlerMapping
@Bean public HandlerMapping resourceHandlerMapping()
Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped resource handlers. To configure resource handling, overrideaddResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry)
.
addResourceHandlers
protected void addResourceHandlers(ResourceHandlerRegistry registry)
Override this method to add resource handlers for serving static resources.
mvcResourceUrlProvider
@Bean public ResourceUrlProvider mvcResourceUrlProvider()
AResourceUrlProvider
bean for use with the MVC dispatcher.- 从以下版本开始:
- 4.1
defaultServletHandlerMapping
@Bean public HandlerMapping defaultServletHandlerMapping()
Return a handler mapping ordered at Integer.MAX_VALUE with a mapped default servlet handler. To configure "default" Servlet handling, overrideconfigureDefaultServletHandling(org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer)
.
configureDefaultServletHandling
protected void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)
Override this method to configure "default" Servlet handling.
requestMappingHandlerAdapter
@Bean public RequestMappingHandlerAdapter requestMappingHandlerAdapter()
Returns aRequestMappingHandlerAdapter
for processing requests through annotated controller methods. Consider overriding one of these other more fine-grained methods:addArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>)
for adding custom argument resolvers.addReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>)
for adding custom return value handlers.configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
for adding custom message converters.
createRequestMappingHandlerAdapter
protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter()
Protected method for plugging in a custom subclass ofRequestMappingHandlerAdapter
.- 从以下版本开始:
- 4.3
getConfigurableWebBindingInitializer
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer()
Return theConfigurableWebBindingInitializer
to use for initializing allWebDataBinder
instances.
getMessageCodesResolver
protected MessageCodesResolver getMessageCodesResolver()
Override this method to provide a customMessageCodesResolver
.
configureAsyncSupport
protected void configureAsyncSupport(AsyncSupportConfigurer configurer)
Override this method to configure asynchronous request processing options.
mvcConversionService
@Bean public FormattingConversionService mvcConversionService()
Return aFormattingConversionService
for use with annotated controllers.See
addFormatters(org.springframework.format.FormatterRegistry)
as an alternative to overriding this method.
addFormatters
protected void addFormatters(FormatterRegistry registry)
Override this method to add customConverter
and/orFormatter
delegates to the commonFormattingConversionService
.
mvcValidator
@Bean public Validator mvcValidator()
Return a globalValidator
instance for example for validating@ModelAttribute
and@RequestBody
method arguments. Delegates togetValidator()
first and if that returnsnull
checks the classpath for the presence of a JSR-303 implementations before creating aOptionalValidatorFactoryBean
.If a JSR-303 implementation is not available, a no-opValidator
is returned.
getValidator
protected Validator getValidator()
Override this method to provide a customValidator
.
getArgumentResolvers
protected final List<HandlerMethodArgumentResolver> getArgumentResolvers()
Provide access to the shared custom argument resolvers used by theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.This method cannot be overridden; use
addArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>)
instead.- 从以下版本开始:
- 4.3
addArgumentResolvers
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Add customHandlerMethodArgumentResolvers
to 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 (e.g.
@RequestParameter
,@PathVariable
, etc). The latter can be customized by configuring theRequestMappingHandlerAdapter
directly.- 参数:
argumentResolvers
- the list of custom converters (initially an empty list)
getReturnValueHandlers
protected final List<HandlerMethodReturnValueHandler> getReturnValueHandlers()
Provide access to the shared return value handlers used by theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.This method cannot be overridden; use
addReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>)
instead.- 从以下版本开始:
- 4.3
addReturnValueHandlers
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
Add customHandlerMethodReturnValueHandlers
in 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 (e.g.
@ResponseBody
,@ModelAttribute
, etc). The latter can be customized by configuring theRequestMappingHandlerAdapter
directly.- 参数:
returnValueHandlers
- the list of custom handlers (initially an empty list)
getMessageConverters
protected final List<HttpMessageConverter<?>> getMessageConverters()
Provides access to the sharedHttpMessageConverters
used by theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.This method cannot be overridden; use
configureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
instead. Also seeaddDefaultHttpMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
for adding default message converters.
configureMessageConverters
protected void configureMessageConverters(List<HttpMessageConverter<?>> converters)
Override this method to add customHttpMessageConverters
to use with theRequestMappingHandlerAdapter
and theExceptionHandlerExceptionResolver
.Adding converters to the list turns off the default converters that would otherwise be registered by default. Also see
addDefaultHttpMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
for adding default message converters.- 参数:
converters
- a list to add message converters to (initially an empty list)
extendMessageConverters
protected void extendMessageConverters(List<HttpMessageConverter<?>> converters)
Override 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.- 参数:
converters
- the list of configured converters to extend- 从以下版本开始:
- 4.1.3
addDefaultHttpMessageConverters
protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Adds a set of default HttpMessageConverter instances to the given list. Subclasses can call this method fromconfigureMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
.- 参数:
messageConverters
- the list to add the default message converters to
mvcUriComponentsContributor
@Bean public CompositeUriComponentsContributor mvcUriComponentsContributor()
Return an instance ofCompositeUriComponentsContributor
for use withMvcUriComponentsBuilder
.- 从以下版本开始:
- 4.0
httpRequestHandlerAdapter
@Bean public HttpRequestHandlerAdapter httpRequestHandlerAdapter()
Returns aHttpRequestHandlerAdapter
for processing requests withHttpRequestHandler
s.
simpleControllerHandlerAdapter
@Bean public SimpleControllerHandlerAdapter simpleControllerHandlerAdapter()
Returns aSimpleControllerHandlerAdapter
for processing requests with interface-based controllers.
handlerExceptionResolver
@Bean public HandlerExceptionResolver handlerExceptionResolver()
Returns aHandlerExceptionResolverComposite
containing a list of exception resolvers obtained either throughconfigureHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
or throughaddDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
.Note: This method cannot be made final due to CGLIB constraints. Rather than overriding it, consider overriding
configureHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
which allows for providing a list of resolvers.
configureHandlerExceptionResolvers
protected void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
Override this method to configure the list ofHandlerExceptionResolvers
to use.Adding resolvers to the list turns off the default resolvers that would otherwise be registered by default. Also see
addDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
that can be used to add the default exception resolvers.- 参数:
exceptionResolvers
- a list to add exception resolvers to (initially an empty list)
extendHandlerExceptionResolvers
protected void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
Override this method to extend or modify the list ofHandlerExceptionResolvers
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.
- 参数:
exceptionResolvers
- the list of configured resolvers to extend.- 从以下版本开始:
- 4.3
addDefaultHandlerExceptionResolvers
protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)
A method available to subclasses for adding defaultHandlerExceptionResolvers
.Adds the following exception resolvers:
ExceptionHandlerExceptionResolver
for handling exceptions throughExceptionHandler
methods.ResponseStatusExceptionResolver
for exceptions annotated withResponseStatus
.DefaultHandlerExceptionResolver
for resolving known Spring exception types
createExceptionHandlerExceptionResolver
protected ExceptionHandlerExceptionResolver createExceptionHandlerExceptionResolver()
Protected method for plugging in a custom subclass ofExceptionHandlerExceptionResolver
.- 从以下版本开始:
- 4.3
mvcViewResolver
@Bean public ViewResolver mvcViewResolver()
Register aViewResolverComposite
that contains a chain of view resolvers to use for view resolution. By default this resolver is ordered at 0 unless content negotiation view resolution is used in which case the order is raised toOrdered.HIGHEST_PRECEDENCE
.If no other resolvers are configured,
ViewResolverComposite.resolveViewName(String, Locale)
returns null in order to allow other potentialViewResolver
beans to resolve views.- 从以下版本开始:
- 4.1
configureViewResolvers
protected void configureViewResolvers(ViewResolverRegistry registry)
Override this method to configure view resolution.- 另请参阅:
ViewResolverRegistry
getCorsConfigurations
protected final Map<String,CorsConfiguration> getCorsConfigurations()
Return the registeredCorsConfiguration
objects, keyed by path pattern.- 从以下版本开始:
- 4.2
addCorsMappings
protected void addCorsMappings(CorsRegistry registry)
Override this method to configure cross origin requests processing.- 从以下版本开始:
- 4.2
- 另请参阅:
CorsRegistry
mvcHandlerMappingIntrospector
@Bean @Lazy public HandlerMappingIntrospector mvcHandlerMappingIntrospector()