spring boot thymeleaf切換版本


新版的spring boot切換版本老是報錯,前段時間解決了,忘 了,重新搜索了一下,記錄一下:

原文地址:https://blog.csdn.net/Mr_Mocha/article/details/97419945

在pom.xml文件中添加以下配置

<properties>
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<!-- 布局功能的支持程序 thymeleaf3主程序 對應 layout2以上版本 -->
<!-- thymeleaf2 對應 layout1版本 -->
<thymeleaf-layout-dialect.version>2.3.0</thymeleaf-layout-dialect.version>
</properties>
1
2
3
4
5
6
如何找到這兩項的配置呢?[官方文檔已經告訴我們了]

找到spring-boot-dependencies這個文件,在里面找對應的配置即可

報錯!!!

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method org.thymeleaf.spring5.SpringTemplateEngine.setRenderHiddenMarkersBeforeCheckboxes(Z)V but it does not exist. Its class, org.thymeleaf.spring5.SpringTemplateEngine, is available from the following locations:

jar:file:/D:/OpenSources/MyRepository/org/thymeleaf/thymeleaf-spring5/3.0.9.RELEASE/thymeleaf-spring5-3.0.9.RELEASE.jar!/org/thymeleaf/spring5/SpringTemplateEngine.class

It was loaded from the following location:

file:/D:/OpenSources/MyRepository/org/thymeleaf/thymeleaf-spring5/3.0.9.RELEASE/thymeleaf-spring5-3.0.9.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.thymeleaf.spring5.SpringTemplateEngine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
解決方案:

<properties>
<springboot-thymeleaf.version>3.0.9.RELEASE</springboot-thymeleaf.version>
<thymeleaf-layout-dialect.version>2.3.0</thymeleaf-layout-dialect.version>
</properties>
1
2
3
4
問題分析:

這里用的是org.springframework.boot下的spring-boot-starter-thymeleaf,使用<thymeleaf.version>做標簽時可能與org.thymeleaf有沖突,導致包獲取不正確
————————————————
版權聲明:本文為CSDN博主「摩卡先生」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/Mr_Mocha/article/details/97419945


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM