最开始参考的是这个 文档 但是并没有解决我的问题,因为他的配置和我的是一样(差不多)的

https://www.cnblogs.com/ginponson/p/6217057.html

然后看到此篇博客

https://bbs.csdn.net/topics/391924615

<!-- 相当于调用SecurityUtils.setSecurityManager(securityManager) -->
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod"
value="org.apache.shiro.SecurityUtils.setSecurityManager" />
<property name="arguments" ref="securityManager" />
</bean>

https://www.cnblogs.com/kibana/p/8953566.html 这篇讲述了 如何配置 MethodInvokingFactoryBean

以下是我的配置

  //主要是这个,但是需要用到 getSecurityManager 所有就贴出来
@Bean
public MethodInvokingFactoryBean getMethodInvokingFactoryBean() {
MethodInvokingFactoryBean methodInvokingFactoryBean=new MethodInvokingFactoryBean();
methodInvokingFactoryBean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager");
methodInvokingFactoryBean.setArguments(getSecurityManager());
return methodInvokingFactoryBean;
} /**
* 创建 DefaultWebSecurityManager
* 需要关联一个Realm
* @Qualifier 获取指定的Bean
* @return
*/
@Bean(name = "webSecurityManager")
public SecurityManager getSecurityManager(){
DefaultWebSecurityManager webSecurityManager=new DefaultWebSecurityManager();
/**
* 配置缓存测量
*/
//配置redis缓存策略
RedisCacheManager redisCacheManager = shiroRedisCache().getCacheManager();
webSecurityManager.setCacheManager(redisCacheManager); //配置 session 管理
SessionManager sessionManager =shiroSessionCache(redisCacheManager).sessionManager();
webSecurityManager.setSessionManager(sessionManager); /**
* 关联多个Realm
*/
Collection<Realm> realms =new ArrayList<>();
// realms.add(realmExtension().getJwtRealm());
realms.add(realmExtension().getUserRealm(doorwayService));
webSecurityManager.setRealms(realms);
Collection<SessionListener> listeners = new ArrayList<>();
return webSecurityManager;
}

Spring boot 整合 shiro 出现 org.apache.shiro.UnavailableSecurityManagerException: 错误的更多相关文章

  1. spring boot 整合 shiro

    shrio官网:https://shiro.apache.org/ Apache Shiro是一个功能强大且易于使用的Java安全框架,可执行身份验证,授权,加密和会话管理.借助Shiro易于理解的A ...

  2. Spring Boot 整合 Shiro ,两种方式全总结!

    在 Spring Boot 中做权限管理,一般来说,主流的方案是 Spring Security ,但是,仅仅从技术角度来说,也可以使用 Shiro. 今天松哥就来和大家聊聊 Spring Boot ...

  3. Spring Boot2 系列教程(三十二)Spring Boot 整合 Shiro

    在 Spring Boot 中做权限管理,一般来说,主流的方案是 Spring Security ,但是,仅仅从技术角度来说,也可以使用 Shiro. 今天松哥就来和大家聊聊 Spring Boot ...

  4. Spring boot整合shiro框架

    ShiroConfiguration package com.energy.common.config; import java.util.LinkedHashMap; import java.uti ...

  5. 上手spring boot项目(二)之spring boot整合shiro安全框架

    题记:在学习了springboot和thymeleaf之后,想完成一个项目练练手,于是使用springboot+mybatis和thymeleaf完成一个博客系统,在完成的过程中出现的一些问题,将这些 ...

  6. spring boot整合shiro

    安全框架Shiro和Spring Security比较,本文主要围绕Shiro进行学习 一 Shiro 是一个强大而灵活的开源安全框架,能够清晰的处理认证 授权 管理会话以及,密码加密 01 .认证与 ...

  7. Spring boot整合shiro权限管理

    Apache Shiro功能框架: Shiro聚焦与应用程序安全领域的四大基石:认证.授权.会话管理和保密. #,认证,也叫作登录,用于验证用户是不是他自己所说的那个人: #,授权,也就是访问控制,比 ...

  8. 学习Spring Boot:(十三)配置 Shiro 权限认证

    经过前面学习 Apache Shiro ,现在结合 Spring Boot 使用在项目里,进行相关配置. 正文 添加依赖 在 pom.xml 文件中添加 shiro-spring 的依赖: <d ...

  9. (转)Spring Boot (十四): Spring Boot 整合 Shiro-登录认证和权限管理

    http://www.ityouknow.com/springboot/2017/06/26/spring-boot-shiro.html 这篇文章我们来学习如何使用 Spring Boot 集成 A ...

  10. Spring Boot(十四):spring boot整合shiro-登录认证和权限管理

    Spring Boot(十四):spring boot整合shiro-登录认证和权限管理 使用Spring Boot集成Apache Shiro.安全应该是互联网公司的一道生命线,几乎任何的公司都会涉 ...

随机推荐

  1. Tomcat非root身份运行制作Linux系统服务管理

    理论知识怱略,马上开始实战 一.首先准备好tomcat 启动.关闭.重启Shell脚本: 以下Shell脚本主要修改值 tomcatPath:tomcat目录 runUser:以哪个身份运行 此处测试 ...

  2. re.compile 函数

    re.compile 函数 compile 函数用于编译正则表达式,生成一个正则表达式( Pattern )对象,供 match() 和 search() 这两个函数使用. 语法格式为: re.com ...

  3. sh_10_字典基本使用

    sh_10_字典基本使用 xiaoming_dict = {"name": "小明"} # 1. 取值 print(xiaoming_dict["na ...

  4. sh_09_字典的定义

    sh_09_字典的定义 # 字典是一个无序的数据集合,使用print函数输出字典时,通常 # 输出的顺序和定义的顺序是不一致的! xiaoming = {"name": " ...

  5. Thread的setDaemon(true)方法的作用

    定义:守护线程--也称“服务线程”,在没有用户线程可服务时会自动离开.优先级:守护线程的优先级比较低,用于为系统中的其它对象和线程提供服务.设置:通过setDaemon(true)来设置线程为“守护线 ...

  6. less基本用法:持续归纳中

    todo 1,嵌套语法:https://www.w3cschool.cn/less/nested_directives_bubbling.html 简单来说就是可以与html一样去写css,并且会继承 ...

  7. wannafly 挑战赛9 D 造一造 (卡特兰数)

    链接:https://www.nowcoder.com/acm/contest/71/D 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64b ...

  8. jpa hibernate mybatis

    jpa: entityManagerFactory: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean hibern ...

  9. 搜狗输入法弹窗搜狐新闻的处理 以及sogoucloud.exe的处理

    https://www.cnblogs.com/Asa-Zhu/p/3359034.html 使用everything搜索SohuNews.exe,然后找到安装路径C:\Program Files ( ...

  10. What is the !! (not not) operator in JavaScript?

    What is the !! (not not) operator in JavaScript? 解答1 Coerces强制 oObject to boolean. If it was falsey ...