org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager

报错信息:

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.

问题分析:

加载不到SecurityManager ,但是你又写了ShiroConfig,并加了@Configuration注解,还是出问题,那么问题可能出现在@SpringBootApplication上没扫码你的ShiroConfig文件

解决办法:

将@SpringBootApplication改成@SpringBootApplication(scanBasePackages = {"com.xxx.xxx"})

注意com.xxx.xxx为你ShiroConfig的包名。

 

正在加载评论...