这篇文章,主要介绍SpringMVC框架如何集成Thymeleaf模板引擎。
目录
一、SpringMVC集成Thymeleaf
1.1、引入Thymeleaf依赖
SpringMVC框架中使用Thymeleaf模板引擎,需要引入thymeleaf的jar包依赖,以及thymeleaf和spring的适配依赖。
<!-- 引入 thymeleaf 依赖 -->
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.11.RELEASE</version>
</dependency>
<!-- 引入 thymeleaf 和 spring5 的支持 -->
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring5 --&