SpringBoot配置静态资源

1.win平台配置(区别在于路径有点不同):

public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**")
                //上传文件目录的静态资源配置
                .addResourceLocations("file:G:\\imooc-dev-sys\\imooc-upload\\")
                //Swagger_ui静态资源配置
                .addResourceLocations("classpath:/META-INF/resources/");
    }


}

你可能感兴趣的:(SpringBoot配置静态资源)