写在前面
在开发过程中,使用模板引擎是很有必要的。我之前学习SSM框架,一直是使用Freemarker作为模板引擎,现在学习了Spring Boot之后,知道Spring Boot推荐使用的模板引擎是Thymeleaf,那么,对于我这种有点轻微强迫症的人来说,肯定是想赶快配置一个Thymeleaf模板引擎。经过查阅资料,配置好后,来发一篇博客记录一下配置过程。
我的Spring Boot版本
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
<relativePath/>
</parent>
添加依赖
在项目的pom.xml添加如下依赖:
<!-- 添加thymeleaf依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artif

本文介绍了如何在Spring Boot项目中配置Thymeleaf模板引擎,包括添加依赖、配置Thymeleaf、测试模板引擎、传值等步骤,并提供了遇到问题时的解决方案,强调了在开发阶段关闭缓存的重要性。
最低0.47元/天 解锁文章
1396

被折叠的 条评论
为什么被折叠?



