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>
相關文章
相關標籤/搜索