springboot 整合thyleaf中spring-boot-starter-parent版本问题。
在学习springboot引入thymeleaf的时候,遇到了一个问题,示例中spring-boot-starter-parent的版本是1.5.10.RELEASE,而本人在练习的时候建里一个springboot的项目,spring-boot-starter-parent的版本是2.1.1.RELEASE。引入thymeleaf的方法是在pom.xml文件中引入:
[code]<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <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>
[code]<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
引入thymeleaf后启动springboot项目会报错。报错信息为:
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:/C:/CODE/maven-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:/C:/CODE/maven-repository/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
百度没有得到解决,然后对比示例和本人的pom文件,发现唯一的不同是spring-boot-starter-parent的版本,于是将自己的spring-boot-starter-parent版本改为1.5.10.RELEASE问题得到解决。
由于时间不多,没有深究原因,在此做个记录,希望能在以后的时间里回头找出根本原因,同时有网友朋友们知道原因的话留个言以帮助到更多的人。
- maven <artifactId>spring-boot-starter-parent</artifactId>里配置的版本<version>1.3.0.M1</version>和<version>1.5.6.RELEASE</version>有什么区别
- mybatis-spring-boot-starter 1.0.1 之后的版本问题
- Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.5.2.RELEASE
- 关于spring-boot自定义starter的引用问题
- springboot多模块化整合mybatis,出现mapper自动注入失败问题
- spring-boot-starter-parent 1.3.6.RELEASE
- spring boot 2.0.0由于版本不匹配导致的NoSuchMethodError问题解析
- Spring Boot中整合MyBatis,相关问题总结
- Spring Boot 整合Thymeleaf 之表单提交 问题
- 记录问题:springboot中使用Mybatis-pagehelper分页插件遇到的版本兼容问题
- 初识spring boot maven管理--使用spring-boot-starter-parent
- spring boot-认识spring-boot-starter-parent
- [小技巧]关于spring boot 整合mybatis-plus: value为null时不返回的问题。
- springboot整合cxf-jaxrs中json转换问题和简单解决方案
- SpringBoot整合Mybatis扫描不到Mapper的问题
- springboot整合Mybatis扫描不到mapper问题
- Springboot整合swagger2项目的部署问题
- IDEA创建一个spring-boot整合Mybatis的模块时,遇到的问题
- 关于Springboot整合mybatis启动的问题
- SpringBoot整合mybatis出现时区问题