No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadC

本文介绍了一个在SpringBoot项目中整合Shiro时遇到的异常问题:无法访问部分接口。原因是错误地使用了@CacheConfig而非@Configuration注解,导致Shiro相关组件未能正确注入到IOC容器中。文中给出了具体的解决方案。

错误产生环境

SpringBoot整合Shiro时产生

错误描述

org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to 
the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm 
static singleton.  This is an invalid application configuration.

错误原因

在这里插入图片描述
本来是想用@Configuration注解的,直接使用到了@CacheConfig注解,主要是用错了注解,有的接口能访问,有的不能访问。直到后面排查IOC容器时,发现shiro相关的对象都没注入进去,才发现问题。

我真的栓Q了家人们!

解决办法

@CacheConfig注解替换为@Configuration注解,问题解决

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值