springboot集成Shiro,添加自定义filter后shiro的默认filter无法使用
来源:互联网 发布:过山车大亨 for mac 编辑:程序博客网 时间:2024/05/18 21:48
在springboot中集成shiro,发现再添加了自定义的filter后默认的filter无法使用。
猜测是自定义的filter被放在了默认的filter前面,导致先被自定义的filter拦截了。
网上搜了一遍,只发现了一篇相关的文章:http://www.hillfly.com/2017/179.html
证实了的确是我所猜想的那般,自定义的filter被放在了shiro默认filter的前面。
根据上面文章作者所说,不要将自定义的在spring容器中进行注册
不过这样又导致了一个新的问题,自定义的filter中无法将spring容器中的bean注入到变量中
注意,这里的Resource注解是后来才去掉的,不要跟我说是因为注释掉了才无法注入。
最后的解决办法就是手动从spring容器中获取bean,然后进行赋值:
这里附上SpringContextUtils的代码
@Componentpublic class SpringContextUtils implements ApplicationContextAware { private static ApplicationContext context; public void setApplicationContext(ApplicationContext context) throws BeansException { SpringContextUtils.context = context; } public static ApplicationContext getContext(){ return context; }}
阅读全文
0 0
- springboot集成Shiro,添加自定义filter后shiro的默认filter无法使用
- Springboot 集成Shiro自定义Filter
- Shiro添加自己的Filter
- shiro默认filter
- shiro 自定义认证filter
- 我的shiro之旅:自定义filter
- shiro filter的入口
- shiro自定义filter 以及调用
- shiro 认证filter 的原理
- shiro讲解之 Shiro Filter
- 我的shiro之旅: 四 自定义filter
- shiro自定义filter之BasicHttpAuthenticationFilter解读
- Shiro 3 filter
- Shiro Filter -- 拦截器
- shiro Filter--拦截器
- 我的shiro之旅: 三 浅谈shiro的filter
- SpringBoot集成shiro
- springboot集成shiro
- 配置ssh认证方式
- java super()的用法1
- 单例模式(Singleton)
- MongoDB对应Java实体类编写方法
- iOS开发中@property的属性weak nonatomic strong readonly等介绍
- springboot集成Shiro,添加自定义filter后shiro的默认filter无法使用
- http协议学习-Cookie和Session
- 文章标题
- Neo4j 出现此提示(no changes ,no records)和解决方法
- 判断一个链表是否为回文结构
- MySQL创建联结
- 2017年山东省机器人比赛 双足竟步 arduino源代码(删去了关键步态程序 gongneng1 和 gongneng2)
- Java设计模式(一) 简单工厂模式不简单
- Eigen教程2-Dense