在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.
shiro配置类中少了
SecurityUtils.setSecurityManager(defaultSecurityManager);
位置:
/**
* Shiro 安全管理器
*
* @return
*/
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
SecurityUtils.setSecurityManager(securityManager);
securityManager.setRealm(myShiroRealm());
return securityManager;
}
来源:oschina
链接:https://my.oschina.net/wuaiting/blog/3232608