@Configuration
public class WebConfig implements WebMvcConfigurer {
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
"classpath:/META-INF/resources/",
"classpath:/resources/",
"classpath:/static/",
"classpath:/public/",
"classpath:/static/upload/",
};
private static final String[] FILE_RESOURCE_LOCATIONS = {
"file:D:/IdeaProject/xxx/src/main/resources/static/upload"
};
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS)
.addResourceLocations(FILE_RESOURCE_LOCATIONS);
}
}
Spring Boot上传图片后无法显示
最新推荐文章于 2023-04-21 18:40:54 发布