在application.properties檔案中新增
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
spring.thymeleaf.mode =LEGACYHTML5
複製程式碼
LEGACYHTML5需要搭配一個額外的庫NekoHTML才可用
專案中使用的構建工具是Maven新增如下的依賴即可完成: pom.xml 中引入
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
複製程式碼