springboot版本从1.5.3升级2.2.x踩坑实录1--org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.backendIdConverterRegistry(RepositoryRestMvcConfiguration.java:721)
1. 报错背景介绍
笔者由于黑鸭子扫描结果需要,对本组的项目进行springboot版本进行升级,由于之前项目所用版本较低,为1.5.3,需要升级到2.2.x,结果出现如下错误:
1 Description: 2 3 An attempt was made to call a method that does not exist. The attempt was made from the following location: 4 5 org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.backendIdConverterRegistry(RepositoryRestMvcConfiguration.java:721) 6 7 The following method did not exist: 8 9 org.springframework.plugin.core.PluginRegistry.of(Ljava/util/List;)Lorg/springframework/plugin/core/PluginRegistry; 10 11 The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations: 12 13 jar:file:/C:/Users/1/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class 14 15 It was loaded from the following location: 16 17 file:/C:/Users/1/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar 18 19 20 Action: 21 22 Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry
2. 解决方案:
从报错信息
1 org.springframework.plugin.core.PluginRegistry.of(Ljava/util/List;)Lorg/springframework/plugin/core/PluginRegistry;
可知 ,spring-plugin-core是1.2.0版本,但是在这个版本里面是没有上述方法。通过查看maven仓库-https://mvnrepository.com/,发现这个jar包就几个版本,不是在低版本就是在高版本中。查验之后发现这个方法是在2.0.0版本中存在的。所以目标明确,去掉1.2.0,引入2.0.0版本,maven依赖如下:
1)修改原pom文件,去掉swagger中引入的1.2.0版本
1 <dependency> 2 <groupId>io.springfox</groupId> 3 <artifactId>springfox-swagger2</artifactId> 4 <version>2.9.2</version> 5 <exclusions> 6 <exclusion> 7 <groupId>org.springframework.plugin</groupId> 8 <artifactId>spring-plugin-core</artifactId> 9 </exclusion> 10 <exclusion> 11 <groupId>org.springframework.plugin</groupId> 12 <artifactId>spring-plugin-metadata</artifactId> 13 </exclusion> 14 </exclusions> 15 </dependency> 16 <dependency> 17 <groupId>io.springfox</groupId> 18 <artifactId>springfox-swagger-ui</artifactId> 19 <version>2.9.2</version>
2)新引入spring-plugin-core的2.0.0版本
<!-- https://mvnrepository.com/artifact/org.springframework.plugin/spring-plugin-core --> <dependency> <groupId>org.springframework.plugin</groupId> <artifactId>spring-plugin-core</artifactId> <version>2.0.0.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.plugin/spring-plugin-metadata --> <dependency> <groupId>org.springframework.plugin</groupId> <artifactId>spring-plugin-metadata</artifactId> <version>2.0.0.RELEASE</version> </dependency>
但是注意一点,这个jar需要提前引入,所以最好要放在父POM文件里面,这样才能起效,否则可能会没效果。
分类:
java
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix