![84565ecb21ea156de9415d1f9a1fabe3.png](https://i-blog.csdnimg.cn/blog_migrate/c74eedd94db92a35bdb46846f9507d44.jpeg)
Spring Security 可以在一些视图技术中进行控制显示效果。例如:
JSP 或 Thymeleaf。在非前后端分离且使用 Spring Boot 的项目中多使
用 Thymeleaf 作为视图展示技术。
Thymeleaf 对 Spring Security 的 支 持 都 放 在
thymeleaf-extras-springsecurityX 中,目前最新版本为 5。所以需要在
项目中添加此 jar 包的依赖和 thymeleaf 的依赖
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
在 html 页面中引入 thymeleaf 命名空间和 security 命
<html xmlns=&