SpringBoot+Tyhmeleaf:Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML'

問題

    最近在使用Thymeleaf的時候,啓動項目,出現了下面的錯誤:[THYMELEAF][main] Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML' instead.


問題分析解決

    出現這個問題,是因爲在application.properties中配置了下面的內容:

spring.thymeleaf.mode=HTML5 

而我引入的Thymeleaf架包沒有指定版本,如下:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> 
這時使用
spring.thymeleaf.mode=HTML

就可以了,因爲沒有沒有配置Thymeleaf的版本號時,默認使用的是Thymeleaf2.1。如果要使用THML5,則在引入Thymeleaf後,需要指定版本:

<properties>
    <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
    <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
</properties>


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