Springboot集成thymeleaf模板引擎

springboot原生支持thymeleaf模板,因此配置起来很是方便html

1.首先配置application.properties文件spring

spring.thymeleaf.prefic=classpath:/templates/缓存

spring.thymeleaf.suffix=.html spring.thymeleaf.mode=HTML5 spring.thymeleaf.encoding=UTF-8springboot

2.pom文件添加依赖app

<dependency>spring-boot

<groupId>org.springframework.boot</groupId>测试

<artifactId>spring-boot-starter-thymeleaf</artifactId>spa

</dependency>code

3.原生支持,因此配置起来很是简单,能够添加扩展htm

# 热部署文件,页面不产生缓存,及时更新

spring.thymeleaf.cache=false

spring.resources.chain.strategy.content.enabled=true

spring.resources.chain.strategy.content.paths=/**

4.简简单单,随便写一个controller测试如下就OK

相关文章
相关标签/搜索