thymeleaf的配置

1、在springboto项目中使用thymeleaf标签,必须先添加依赖,如下。

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

2、在application.properties中配置一些常用的thymeleaf,如下。

spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.check-template-location=true spring.thymeleaf.suffix=.html spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html spring.thymeleaf.mode=HTML5 spring.thymeleaf.cache=false

可参考博客:https://blog.csdn.net/ice_lemon_g/article/details/73609020

原文地址:https://www.cnblogs.com/ming-blogs/p/10288598.html