vue打包到jar资源访问被shiro拦截

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文件静态资源开放

     
            
                src/main/resources
                
                    **/*.*
                
                true
            
        

先记录一下配置,具体原理有时间再整理!

你可能感兴趣的:(vue.js,前端,java)