spring boot thymeleaf切换版本

mac2022-06-30  22

新版的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>123456如何找到这两项的配置呢?[官方文档已经告诉我们了]

找到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.SpringTemplateEngine123456789101112131415161718解决方案:

<properties> <springboot-thymeleaf.version>3.0.9.RELEASE</springboot-thymeleaf.version> <thymeleaf-layout-dialect.version>2.3.0</thymeleaf-layout-dialect.version></properties>1234问题分析:

这里用的是org.springframework.boot下的spring-boot-starter-thymeleaf,使用<thymeleaf.version>做标签时可能与org.thymeleaf有冲突,导致包获取不正确————————————————版权声明:本文为博主「摩卡先生」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/Mr_Mocha/article/details/97419945

转载于:https://www.cnblogs.com/linwenbin/p/11441336.html

最新回复(0)