This commit is contained in:
pengjie 2025-09-01 09:09:37 +08:00
parent e1af1adbd0
commit 3e3748f64b
2 changed files with 18 additions and 18 deletions

View File

@ -431,9 +431,7 @@
<properties>
<profiles.active>dev</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<!--测试环境-->
<profile>
@ -455,7 +453,9 @@
<properties>
<profiles.active>prod</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>

View File

@ -36,18 +36,18 @@ public class MvcConfig implements WebMvcConfigurer {
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**") // 匹配所有的路径
// .allowCredentials(true) // 设置允许凭证
// .allowedHeaders("*") // 设置请求头
// .allowedMethods("GET", "POST", "PUT", "DELETE") // 设置允许的方式
// .allowedOriginPatterns("*");
// }
//
// @Override
// public void configurePathMatch(PathMatchConfigurer configurer) {
// configurer
// .addPathPrefix("/village",c -> c.isAnnotationPresent(RestController.class));
// }
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 匹配所有的路径
.allowCredentials(true) // 设置允许凭证
.allowedHeaders("*") // 设置请求头
.allowedMethods("GET", "POST", "PUT", "DELETE") // 设置允许的方式
.allowedOriginPatterns("*");
}
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer
.addPathPrefix("/village",c -> c.isAnnotationPresent(RestController.class));
}
}