Browse Source

修改跨域配置,修改图片文件映射地址

master
ssl 2 years ago
parent
commit
8958b3ef5f
  1. 10
      vote/src/main/java/com/votesystem/ssl/config/MyWebConfiguration.java

10
vote/src/main/java/com/votesystem/ssl/config/MyWebConfiguration.java

@ -18,14 +18,18 @@ public class MyWebConfiguration implements WebMvcConfigurer {
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE") .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.allowedHeaders("*") .allowedHeaders("*")
.maxAge(3600); .maxAge(3600);
} @Override
}
@Value("${image.save-path}")
private String imagePath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/api/file/**").addResourceLocations("file:" + imagePath + "/"); registry.addResourceHandler("/api/file/**").addResourceLocations("file:" + imagePath + "/");
// registry.addResourceHandler(imagePath).addResourceLocations("file:" + imagePath + "/"); // registry.addResourceHandler(imagePath).addResourceLocations("file:" + imagePath + "/");
} }
@Value("${image.save-path}")
private String imagePath;

Loading…
Cancel
Save