行业知识
SpringBoot3整合Mybatis-plus报错IllegalArgumentException
2026-11-16 05:39:57
来源:互联网转载
错误信息
使���的SpringBoot3版本:3.2.3
java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
第一想法就是感觉是版本太低导致和SpringBoot3不兼容。
查询mybatis-plus最高的版本
com.baomidou mybatis-plus-boot-starter 3.5.5
将引入的mybatis-plus依赖的版本升到最高版本后,重新启动项目,依旧报同样的错。
那就只能说明我们使用的SpringBoot应用程序的版本太高了,mybatis-plus还没有针对SpringBoot3的最新版本做出兼容性处理。
解决办法
在mybatis-plus的依赖中先排除 mybatis-plus 和 spring整合的类:mybatis-spring,
然后再单独的将mybatis-spring依赖引入,此时引入的是mybatis-spring最高版本。在mybatis-plus中mybatis-spring默认的版本是2.几的,所以我们这里引入最新3.0.3版本,这个版本和SpringBoot 3.2.3是兼容的。
com.baomidou mybatis-plus-boot-starter 3.5.5 org.mybatis mybatis-spring org.mybatis mybatis-spring 3.0.3
结果
可以发现,能够成功运行了!