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提供的工具查看依赖

 步骤二:点击进去,找到最左左边红色的箭头,然后点击进去,找到那个引用,删除尝试即可

 

完美

posted @ 2023-04-26 14:24  李东平|一线码农  阅读(2425)  评论(0编辑  收藏  举报