thymeleaf是一个模板引擎
thymeleaf命名空间
<html lang="en" xmlns:th="http://www.thymeleaf.org">
thymeleaf和spring security整合命名空间:
xmlns:sec="http://www.w3.org/1999/xhtml"
推荐自行去网站
https://mvnrepository.com/
内搜索需要的最新版本的依赖。
<!--thymeleaf启动器坐标-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>

本文介绍了Thymeleaf,一个用于Web和独立环境的现代服务器端Java模板引擎。它强调自然模板语法,使得HTML文档在没有被模板引擎处理时也能正常工作。在Spring Boot应用中,Thymeleaf可以与Spring Security进行整合,提供安全控制。通过添加特定的命名空间如`<sec>`,可以实现权限控制等功能。要开始使用Thymeleaf,可以在项目中引入相应的Maven依赖,例如`spring-boot-starter-thymeleaf`、`thymeleaf-spring5`和`thymeleaf-extras-java8time`。
179

被折叠的 条评论
为什么被折叠?



