thymeleaf 设置不校验html标签

默认配置下,thymeleaf对.html的内容要求很严格,好比,若是少封闭符号/,就会报错而转到错误页。也好比你在使用Vue.js这样的库,而后有<div v-cloak></div>这样的html代码,也会被thymeleaf认为不符合要求而抛出错误。html

经过设置thymeleaf模板能够解决这个问题,下面是具体的配置:java

spring.thymeleaf.cache=false
spring.thymeleaf.mode=LEGACYHTML5
<dependency>
	<groupId>net.sourceforge.nekohtml</groupId>
	<artifactId>nekohtml</artifactId>
	<version>1.9.22</version>
</dependency>
相关文章
相关标签/搜索