SpringBoot配置thymeleaf3+layout2

一.查看官网文档

网址:https://docs.spring.io/spring-boot/docs/1.5.9.RELEASE/reference/htmlsingle/

1)、使用thymeleaf需要导入依赖

SpringBoot配置thymeleaf3+layout2

SpringBoot配置thymeleaf3+layout2 

<!--thymeleaf模板引擎-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

2)、切换thymeleaf2到thymeleaf3

SpringBoot配置thymeleaf3+layout2

   需要修改pom中默认的依赖

SpringBoot配置thymeleaf3+layout2

<properties>
    <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
    <!-- 布局功能的支持程序  thymeleaf3主程序  layout2以上版本 -->
    <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
</properties>