<div> <span style="color: rgb(0, 128, 128); font-weight: bold;">Apache Shiro</span> 是一个开源的轻量级的 <span style="color: rgb(0, 128, 128); font-weight: bold;">Java </span>安全框架,它提供身份验证、授权、密码管理以及会话管理等功能。相对于 <span style="color: rgb(0, 128, 128); font-weight: bold;">Spring Security</span>,<span style="color: rgb(0, 128, 128); font-weight: bold;">Shiro </span>框架更加直观、易用,同时也能提供健壮的安全性。</div>
在传统的
SSM 框架中,手动整合
Shiro 的配置步骤还是比较多的,针对
Spring Boot,
Shiro 官方提供了
shiro-spring-boot-web-starter 用来简化
Shiro 在
Spring Boot 中的配置。下面通过样例进行演示。
首先编辑项目的 pom.xml 文件,添加 Shiro 依赖以及页面模板依赖:
- shiro-spring-boot-web-starter:Shiro 依赖
- spring-boot-starter-thymeleaf:Thymeleaf 依赖,本样例使用了 Thymeleaf 模版。
- thymeleaf-extras-shiro:实现在 Thymeleaf 中使用 shiro 标签。
注意: 这里不需要添加
spring-boot-starter-web 依赖,因为
shiro-spring-boot-web-starter 中已经依赖了
spring-boot-starter-web
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.bianchenghao6.com/h6javajc/8570.html