1.shiro放发对静态资源的拦截
// filterMap.put("/202307171550/**", "anon");
// filterMap.put("/config/**", "anon");
// filterMap.put("/index.html", "anon");
2.装载资源访问
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {"classpath:/META-INF/resources/", "classpath:/resources/","classpath:/static/", "classpath:/public/" };@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {if (!registry.hasMappingForPattern("/**")) {registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);}
}
3.pom文件静态资源开放
<resources><resource><directory>src/main/resources</directory><includes><include>**/*.*</include></includes><filtering>true</filtering></resource></resources>
先记录一下配置,具体原理有时间再整理!