zhuangjie
ZhuangJie

yml或properties检查是否添加了这个配置: Ctrl+F 搜索一下

     resources:
         add-mappings: false

如果存在,那么极有可能就是它了,使静态资源访问

解决方法一:

去除

解决方法二:

添加

@Component
public class WebSecurityConfigStaticFree implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/", "/static", "/public");

        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}

 

posted on 2021-07-02 15:39  zhuangjie  阅读(187)  评论(0)    收藏  举报