springboot模板引擎thymeleaf對於沒有關閉標籤的錯誤解析

在使用springboot結合thymeleaf的時候,我們需要做出以下配置正確解析html:
添加pom.xml的依賴:

        <dependency>
            <groupId>net.sourceforge.nekohtml</groupId>
            <artifactId>nekohtml</artifactId>
            <version>{隨便都可以}</version>
        </dependency>

application.properties文件添加以下配置:

spring.thymeleaf.mode=LEGACYHTML5
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章