java之thymeleaf使用

pom.xml增加如下配置

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
    <version>2.1.4.RELEASE</version>
</dependency>

 

application.properties增加如下配置

#thymelea模板配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
#热部署文件,页面不产生缓存,及时更新
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**

 

thymeleaf表达式语法参考:

https://www.jianshu.com/p/908b48b10702

 

posted @ 2019-05-08 11:51  过了这个村  阅读(375)  评论(0编辑  收藏  举报

正是因为短暂的生命中有那么多困难和不如意,死亡又在一旁窥视着我们,所以我们没有时间忧伤和叹息,我们必须认真地对待生命,去思考,去寻找。