开头奉上官方文档(http://www.thymeleaf.org/doc/articles/layouts.html)!
博主在整合前台页面整体布局的时候发现 layout:fragment 使用不了,查了一个多小时资料,才发现要引入一个包,下面奉上maven引入(建议在整合thymeleaf的时候顺便一起把这个依赖下载下来!!!!):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> <!-- thymeleaf依赖-->
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.2.1</version> <!-- dialect依赖-->
</dependency>
下面开始创建模板(建立如下文件):