错误描述

an attempt was made to call a method that does not exist. the attempt was made from the following location:

com.baomidou.mybatisplus.core.mybatismapperannotationbuilder.getlanguagedriver(mybatismapperannotationbuilder.java:369)

the following method did not exist:

com.baomidou.mybatisplus.core.mybatisconfiguration.getlanguagedriver(ljava/lang/class;)lorg/apache/ibatis/scripting/languagedriver;

the method’s class, com.baomidou.mybatisplus.core.mybatisconfiguration, is available from the following locations:

说明

springboot版本:2.3.9.release
mybatis-plus版本:3.3.1

这个问题不是一开始就存在的,在springboot版本2.x是正常的,但是在提升springboot版本后,就出现了这个问题

解决过程

首先不要果断的下定论这个是什么问题,类似这样的问题可以通过idea工具定位一下,鼠标点击【1】位置进入到对应的代码位置,注意要点击右上角提示的download source下载源码

待代码下载完毕之后,这里可以很清晰的看到configuration没有getlanguagedriver这个方法,在进入到configuration对象

可以看到最终定位到了上面的位置,然后看到extends关键字可以分析出getlanguagedriver肯定是存在于下面的俩个类中的

在针对上面俩个包路径分析,可以看到第一个是属于mybatisplus.core依赖下的,第二个是属于mybatis依赖下,于是针对这俩种情况分别做个测试
1、升级mybatisplus包依赖,但是我这边已经是很高的版本的了,及时升级到最新的版本后依然没有看到getlanguagedriver方法,所以问题不在这里
2、升级mybatis包,由于引入的mybatis-plus-boot-starter已经集成了mybatis包,所以这里需要首先将其exclude,然后引入单独的较高版本的mybatis包依赖

升级完成之后再进入到刚才错误的位置,可以看到已经正常了

可以看到最终这个方法处理逻辑是由父类完成的

到此这篇关于mybatis-plus与mybatis依赖冲突问题解决方法的文章就介绍到这了,更多相关mybatis-plus与mybatis依赖冲突内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!