Correct the classpath of your application so that it contains a single, compatible version of xxx报错解决
1.背景
有时候引入包有冲突,比如在Maven项目中的不同模块多次重复引入等
这里遇到的问题是重复映入了如下包:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0-RELEASE</version>
</dependency>
导致启动报错如下:
.....
.....
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-04-26 14:08:36.800 | | main | ERROR | o.s.b.diagnostics.LoggingFailureAnalysisReporter:40 -
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration.applyConfiguration(MybatisPlusAutoConfiguration.java:190)
The following method did not exist:
com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.setConfiguration(Lorg/apache/ibatis/session/Configuration;)V
The method's class, com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean, is available from the following locations:
jar:file:/D:/repository/com/baomidou/mybatis-plus-extension/3.1.0/mybatis-plus-extension-3.1.0.jar!/com/baomidou/mybatisplus/extension/spring/MybatisSqlSessionFactoryBean.class
It was loaded from the following location:
file:/D:/repository/com/baomidou/mybatis-plus-extension/3.1.0/mybatis-plus-extension-3.1.0.jar
2.问题排查步骤
步骤一:利用idea提供的工具查看依赖
步骤二:点击进去,找到最左左边红色的箭头,然后点击进去,找到那个引用,删除尝试即可
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律