首先添加thymeleaf起步依赖:

  <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
  </dependency>

如果maven出现找不到默认要导入thymeleaf的jar版本时,我们可以自己指定thymeleaf主程序的版本和对应 layout的版本:

 <properties>
        <springboot-thymeleaf.version>3.0.9.RELEASE</springboot-thymeleaf.version>
        <thymeleaf-layout-dialect.version>2.3.0</thymeleaf-layout-dialect.version>
 </properties>

WinRT
21 声望4 粉丝

临渊羡鱼,不如退而结网