错误产生环境
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注解,问题解决

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

3万+

被折叠的 条评论
为什么被折叠?



