解決 SpringBoot Shrio Thymeleaf 靜態資源被攔截的問題

我嘗試了多種方法:1、配置了 Shiro 的 filter,把static 標識爲anon 。2、直接用MVCConfiger映射 static 出去。

以上兩種方法均無果。

解決方案:

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

     @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
 
        /** swagger配置 */
        registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章