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

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. 用CSS制作箭头的方法

     一.箭头产生的原理 #demo12 { border: 100px solid; border-color:green blue orange red; width:100px; height:10 ...

  2. C# 时间格式转换

    DateTime dd =DateTime.Parse(temp[0]);  string aa = dd.ToShortDateString();

  3. 学习笔记:python3,代码。小例子习作

    http://www.cnblogs.com/qq21270/p/7634025.html 学习笔记:python3,一些基本语句(一些基础语法的代码,被挪到这里了) 日期和时间操作 http://b ...

  4. C++入门经典-例5.20-右值引用传递参数

    1:使用字面值(如1.3.15f.true),或者表达式等临时变量作为函数实参传递时,按左值引用传递参数会被编译器阻止.而进行值传递时,将产生一个和参数同等大小的副本.C++11提供了右值引用传递参数 ...

  5. 第六周课程总结&实验报告(四)

    实验报告(四) 一.实验目的 1.掌握类的继承 2.变量的继承和覆盖,方法的继承,重载和覆盖的实现 二.实验的内容 1.根据下面的要求实现圆类Circle. 圆类Circle的成员变量:radius表 ...

  6. python3笔记十:python数据类型-Tuple元组

    一:学习内容 元组概念 元组创建.访问.删除 元组操作 元组方法 二:元组概念 1.本质:是一种有序集合 2.特点:与列表非常相似.一旦初始化就不能修改.使用小括号 三:元组创建 1.创建空元组 tu ...

  7. LeetCode 120. 三角形最小路径和(Triangle)

    题目描述 给定一个三角形,找出自顶向下的最小路径和.每一步只能移动到下一行中相邻的结点上. 例如,给定三角形: [ [2], [3,4], [6,5,7], [4,1,8,3] ] 自顶向下的最小路径 ...

  8. 【Spark机器学习速成宝典】基础篇04数据类型(Python版)

    目录 Vector LabeledPoint Matrix 使用C4.5算法生成决策树 使用CART算法生成决策树 预剪枝和后剪枝 应用:遇到连续与缺失值怎么办? 多变量决策树 Python代码(sk ...

  9. 【数据算法】Java实现二叉树存储以及遍历

    二叉树在java中我们使用数组的形式保存原数据,这个数组作为二叉树的数据来源,后续对数组中的数据进行节点化操作. 步骤就是原数据:数组 节点化数据:定义 Node节点对象 存储节点对象:通过Linke ...

  10. note:开源许可证之间的区别

    最近接触开源项目比较多,关注一下许可证的问题. 饱受诟病的病毒式copyleft就是GPL了.. ref:http://code.csdn.net/news/2819582 ref:http://ww ...