This commit is contained in:
pengjie 2025-07-14 17:34:37 +08:00
parent e74ceaebd0
commit 68b1879793

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));
}
}