了方便每次修改HTML文件都能实时刷新,做一下更改。
在application.properties文件加入以下命令:
#thymeleaf start
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
#开发时关闭缓存,不然没法看到实时页面
spring.thymeleaf.cache=false
#thymeleaf end
打开IDEA->File->setting,勾选自动编译


然后重启项目,更改HTML文件后ctrl+s保存后,刷新页面即可看到更新。
实时刷新Thymeleaf
本文介绍如何配置Spring Boot项目中的Thymeleaf模板引擎,使其在开发过程中能够实时刷新页面,包括修改application.properties文件中的Thymeleaf设置,以及在IDEA中启用自动编译功能。
502

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



