类 DemoWebConfiguration
java.lang.Object
net.sohelp.boot.demo.config.DemoWebConfiguration
- 所有已实现的接口:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Configuration
@ComponentScan(basePackages="net.sohelp.boot.demo")
public class DemoWebConfiguration
extends Object
implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Web配置类
用于配置Spring MVC的相关设置,包括资源处理器和跨域访问配置
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry registry) 支持跨域访问 配置CORS跨域资源共享策略voidaddResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) 添加资源处理器 配置静态资源的访问路径和位置从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 org.springframework.web.servlet.config.annotation.WebMvcConfigurer
addArgumentResolvers, addErrorResponseInterceptors, addFormatters, addInterceptors, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
-
构造器详细资料
-
DemoWebConfiguration
public DemoWebConfiguration()
-
-
方法详细资料
-
addResourceHandlers
public void addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) 添加资源处理器 配置静态资源的访问路径和位置- 指定者:
addResourceHandlers在接口中org.springframework.web.servlet.config.annotation.WebMvcConfigurer- 参数:
registry- 资源处理器注册器
-
addCorsMappings
public void addCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry registry) 支持跨域访问 配置CORS跨域资源共享策略- 指定者:
addCorsMappings在接口中org.springframework.web.servlet.config.annotation.WebMvcConfigurer- 参数:
registry- CORS注册器
-