引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
我们的boot
的starter
已经整合过了,不需要版本坐标。
创建
创建一个HTML
文件。
我们需要再<html>
标签里面加点东西。
运行
我直接打开这个html
时,他是这样的。
因为我们需要web
服务对thymeleaf
语法进行处理。
配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
我们也可以再SpringBoot
的配置文件中,配置相关设置。
至于使用方法,请参考其他资料吧。