springboot定时任务未登录情况下获取用户信息报错解决方案

解决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.

图片报错的信息: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.
springboot 定时任务因为需要在登陆情况下获取用户信息,所以直接获取用户信息时报错的
这样无法会无法获取用户信息。加入这两行代码之后只会在登录之后获取用户的信息参考连接:https://blog.csdn.net/f1370335844/article/details/96845039

猜你喜欢

转载自blog.csdn.net/qq_42623440/article/details/113125049
今日推荐