上传图片到服务器,第一次是404,需要进入项目才会加载图片的问题
作者:互联网
配置加载资源
@Configuration
public class WebMvcConfigure implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**")
.addResourceLocations("file:E:/benke/lx/travel/src/main/resources/static/")
.addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX+ "/static/");
}
标签:ResourceHandlerRegistry,图片,404,static,registry,addResourceLocations,加载 来源: https://www.cnblogs.com/jk200/p/15707031.html