您的位置:首页 > 编程语言 > Java开发

IDEA开发springboot遇到的问题:org.thymeleaf.spring5.SpringTemplateEngine.setRenderHiddenMarkersBeforeCheckbo

2020-04-20 19:04 477 查看

1.出错情况

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:/E:/springboot/repository/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:/E:/springboot/repository/org/thymeleaf/thymeleaf-spring5/3.0.9.RELEASE/thymeleaf-spring5-3.0.9.RELEASE.jar

2.出错原因:这种错误有可能是thymeleaf版本不匹配造成的

(1). 我之前创建springboot项目的时候用的是如下的thymeleaf版本

<properties>
<java.version>1.8</java.version>
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<!-- 布局功能的支持程序  thymeleaf3主程序  layout2以上版本 -->
<!-- thymeleaf2   layout1-->
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties>

//以下内容与版本无关
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

这种错误是由与thymeleaf.version与thymeleaf-layout-dialect.version的版本冲突造成的,
布局功能的支持程序 thymeleaf3主程序 layout2以上版本或者thymeleaf2对应layout1。但是其实这句话是有问题的,具体的版本匹配我们需要查看官网才能知道。。。。但是我目前也不清楚这个具体版本匹配在哪里查询。
因为现在的3.0.9与2.2.2已经不匹配,所以我们需要修改一下版本,只要版本匹配就行。请看下一节修改后的测试结果

(2). 修改版本后

<properties>
<java.version>1.8</java.version>
<thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
<!-- 布局功能的支持程序  thymeleaf3主程序  layout2以上版本 -->
<!-- thymeleaf2   layout1-->
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties>

我这里把修改成了3.0.11,此时我的测试结果就对了,如下

  • 点赞
  • 收藏
  • 分享
  • 文章举报
while(1); 发布了6 篇原创文章 · 获赞 3 · 访问量 131 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: