首先添加thymeleaf起步依賴:spring
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
若是maven出現找不到默認要導入thymeleaf的jar版本時,咱們能夠本身指定thymeleaf主程序的版本和對應 layout的版本:springboot
<properties> <springboot-thymeleaf.version>3.0.9.RELEASE</springboot-thymeleaf.version> <thymeleaf-layout-dialect.version>2.3.0</thymeleaf-layout-dialect.version> </properties>