SpringBoot3整合Mybatis-Plus与PageHelper包冲突解决

😊 @ 作者: 一恍过去
💖 @ 主页: https://blog.csdn.net/zhuocailing3390
🎊 @ 社区: Java技术栈交流
🎉 @ 主题: SpringBoot3整合Mybatis-Plus与PageHelper包冲突解决
⏱️ @ 创作时间: 2024年03月15日

在这里插入图片描述

目录

    • 前言
    • 1、SpringBoot3在整合Mybatis-Plus与PageHelper的同时会出现,包冲突问题
    • 2、factoryBeanObjectType错误
    • 3、完整pom配置

前言

在将项目由SpringBoot2.x升级为SpringBoot3.2.0时,对Mybatis-Plus及Pagehelper同时进行了升级,升级过程组出现了包冲突以及factoryBeanObjectType异常的情况,下面是一个总结!

1、SpringBoot3在整合Mybatis-Plus与PageHelper的同时会出现,包冲突问题

pagehelper-spring-boot-starter包中会引入mybatis-spring-boot-starter包,会与mybatis-plus-boot-starter出现冲突:

***************************
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.MybatisPlusProperties$CoreConfiguration.applyTo(MybatisPlusProperties.java:356)The following method did not exist:'void org.apache.ibatis.session.Configuration.setArgNameBasedConstructorAutoMapping(boolean)'The calling method's class, com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties$CoreConfiguration, was loaded from the following location:jar:file:/D:/m2/com/baomidou/mybatis-plus-spring-boot-autoconfigure/3.5.4.1/mybatis-plus-spring-boot-autoconfigure-3.5.4.1.jar!/com/baomidou/mybatisplus/autoconfigure/MybatisPlusProperties$CoreConfiguration.classThe called method's class, org.apache.ibatis.session.Configuration, is available from the following locations:jar:file:/D:/m2/org/mybatis/mybatis/3.5.9/mybatis-3.5.9.jar!/org/apache/ibatis/session/Configuration.classThe called method's class hierarchy was loaded from the following locations:org.apache.ibatis.session.Configuration: file:/D:/m2/org/mybatis/mybatis/3.5.9/mybatis-3.5.9.jarAction:Correct the classpath of your application so that it contains compatible versions of the classes com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties$CoreConfiguration and org.apache.ibatis.session.Configuration

解决包冲突:
需要排除mybatis-spring-boot-starter

<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.4.5</version><exclusions><exclusion><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId></exclusion></exclusions></dependency>

2、factoryBeanObjectType错误

出现java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String异常信息

java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBeanObjectType': java.lang.Stringat org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBeanFromAttributes(FactoryBeanRegistrySupport.java:86)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:838)at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:620)at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:573)at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:532)at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:138)at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:775)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:597)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753)at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455)at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342)at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331)at com.lhz.demo.DemoApplication.main(DemoApplication.java:10)

解决方案:
需要排除mybatis-plus-boot-startermybatis-spring,并且单独引入高版本的mybatis-spring

<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.4.1</version><exclusions><exclusion><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>3.0.3</version></dependency>

3、完整pom配置

<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.4.5</version><exclusions><exclusion><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId></exclusion></exclusions></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.4.1</version><exclusions><exclusion><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>3.0.3</version></dependency>

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/758517.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Elasticsearch - Docker安装Elasticsearch8.12.2

前言 最近在学习 ES&#xff0c;所以需要在服务器上装一个单节点的 ES 服务器环境&#xff1a;centos 7.9 安装 下载镜像 目前最新版本是 8.12.2 docker pull docker.elastic.co/elasticsearch/elasticsearch:8.12.2创建配置 新增配置文件 elasticsearch.yml http.host…

大模型时代,微软AI投资的布局

这些领域涉及 3D、代码、销售、游戏等多个行业。其中&#xff1a; 在 3D 领域&#xff0c;blackshark.ai 利用 AI 技术提供地理空间数据解决方案&#xff1b;humane 专注于人机交互技术创新&#xff1b;Builder.ai 提供了无需编程知识的应用构建平台。代码方面&#xff0c;GitH…

C++ 编程入门指南:深入了解 C++ 语言及其应用领域

C 简介 什么是 C&#xff1f; C 是一种跨平台的编程语言&#xff0c;可用于创建高性能应用程序。 C 是由 Bjarne Stroustrup 开发的&#xff0c;作为 C 语言的扩展。 C 为程序员提供了对系统资源和内存的高级控制。 该语言在 2011 年、2014 年、2017 年和 2020 年进行了 4…

Allegro许可有效期

在数字化经济的时代&#xff0c;软件已经成为企业运营的关键要素。然而&#xff0c;如何确保软件许可的有效性&#xff0c;避免因过期使用带来的风险&#xff0c;是企业面临的挑战。Allegro作为业界领先的软件解决方案提供商&#xff0c;为企业提供了一站式的许可有效期管理方案…

Java基础学习笔记三

环境变量CLASSPATH classpath环境变量是隶属于java语言的&#xff0c;不是windows操作系统的&#xff0c;和PATH环境变量完全不同classpath环境变量是给classloader&#xff08;类加载器&#xff09;指路的java A 。执行后&#xff0c;先启动JVM&#xff0c; JVM启动classload…

GIS学习

匹配查询&#xff0c;先连接两个表&#xff0c;然后在一个表里面查询 合并两个形状 比较好的colormap http://soliton.vm.bytemark.co.uk/pub/cpt-city/views/totp-cpt.html https://docs.gmt-china.org/latest/cpt/builtin-cpt/ 计算坡度时就要捕捉栅格 重分类时也要捕捉栅…

数据结构:10、排序

本文将会介绍8种排序&#xff0c;并在文章末附上代码 一、排序的概念 排序&#xff1a;所谓排序&#xff0c;就是使一串记录&#xff0c;按照其中的某个或某些关键字的大小&#xff0c;递增或递减的排列起来的操作。 稳定性&#xff1a;假定在待排序的记录序列中&#xff0c;…

[蓝桥杯 2019 省 A] 外卖店优先级

模拟 双指针 #include<iostream> #include<algorithm> using namespace std; using ll long long; #define int long long const int N 1e510; const int inf 0x3f3f3f3f; const int mod 1e97;int n,m,ts;bool vis[N]; int a[N]; int last[N]; pair<int,int…

外卖项目:菜品管理功能代码实现(debug)

文章目录 一、菜品管理功能代码实现1、新增菜品2、菜品分页查询3、修改菜品4、菜品的起售与停售5、删除菜品 一、菜品管理功能代码实现 1、新增菜品 这涉及到多张表&#xff0c;要用事务 添加成功 2、菜品分页查询 3、修改菜品 该页面共涉及4个接口。 接口&#xff1a; 根…

fastutil 代替java 集合框架

背景 java的集合框架中ArrayList&#xff0c;Map&#xff0c;Set等是我们平时最常用的集合类&#xff0c;但是由于这些集合类涉及拆装箱操作&#xff0c;所以内存的消耗比较大&#xff0c;并且性能也不是非常理想&#xff0c;在应付大量的数据时&#xff0c;容易导致gc以及性能…

protobuf原理解析-基于protobuf-c实现序列化,反向序列化

1.一个实例 前面介绍了使用protobuf的流程&#xff0e; (1). 定义proto文件来描述需要序列化和反向序列化传输的消息&#xff0e; (2). 借助proto-c&#xff0c;为proto文件生成对应的代码控制文件&#xff0e; (3). 程序借助生成的代码控制文件和protobuf-c动态库的支持实现类…

如何写出干净的 Git Commit

大家好&#xff0c;我是楷鹏。 写一份干净的 Git Commit&#xff0c;不仅赏心悦目&#xff0c;也有诸多好处&#xff0c;比如 为项目或者仓库生成 change log方便在其他一些 Git 工具使用&#xff0c;比如 CI/CD、代码协作和审计平台、发版工具等 这是 AngularJS 仓库的 Git …

身份证文字识别ocr免费-身份证实名认证接口-护照识别-Java调用代码

文字识别技术是针对图片上的文字进行提取&#xff0c;免去人们手动输入的繁琐。针对证件&#xff0c;翔云提供了身份证识别接口、身份证实名认证接口、护照识别接口&#xff0c;身份证识别接口自动提取身份证信息、身份证实名认证接口实时联网查验身份证的真伪。 以身份证识别…

ActiViz三维场景的基本要素——角色(Actor)

文章目录 前言一、基本属性二、Actor的应用三、高级功能四、示例代码和应用五、总结前言 在ActiViz中,Actor是一种重要的可视化对象,用于表示三维场景中的几何形状、模型或数据。Actors充当了将数据映射到图形管线中的角色,是呈现三维可视化的基础组件之一。通过Actor,用户…

go 解决货币计算的难题:避免浮点数陷阱

在开发的初始阶段&#xff0c;我们经常会遇到“浮点数精度”和“货币值表示”的问题。 那么&#xff0c;如何处理货币&#xff0c;如何存储和传递它们。 为什么是问题&#xff1f; Go语言中的标准浮点类型具有一定的精度&#xff08;像其他任何语言一样&#xff09;&#xf…

前端性能优化:防抖与节流

一、防抖和节流主要是干什么的 防抖和节流主要用于控制函数执行的频率&#xff0c;通过限制函数的触发次数&#xff0c;避免函数被过度调用而引发的性能问题或产生不必要的副作用。 二、防抖 什么是防抖&#xff1a; 防抖的原理是在函数频繁触发时&#xff0c;只执行最后一…

记录(Vue3中常用的组合式API)

Ref 通过组合式API提供的ref函数&#xff0c;可以使数据管理变得更加便利。说得通俗点&#xff0c;就是ref能够使我们在组件内更新这个值 import { ref } from vue; const count ref(0); const increment () > { count.value; }; 以上定义了一个名为count的ref&a…

HiveQL详解

文章目录 前言一、数据定义语言&#xff08;DDL&#xff09;1. 数据库操作1.1 创建数据库1.2 删除数据库1.3 更改数据库1.4 使用数据库 2. 连接器操作2.1 创建连接器2.2 删除连接器2.3 修改连接器 3. 表操作3.1 创建表3.1.1 内部表与外部表3.1.1.1 内部表3.1.1.2 外部表3.1.1.3…

解释关系型数据库和非关系型数据库的区别

一、解释关系型数据库和非关系型数据库的区别 关系型数据库和非关系型数据库在多个方面存在显著的区别。 首先&#xff0c;从数据存储方式来看&#xff0c;关系型数据库采用表格形式&#xff0c;数据存储在数据表的行和列中&#xff0c;且数据表之间可以关联存储&#xff0c;…

短视频矩阵系统技术交付

短视频矩阵系统技术交付&#xff0c;短视频矩阵剪辑矩阵分发系统现在在来开发这个市场单个项目来说&#xff0c;目前基本上已经沉淀3年了&#xff0c;那么我们来就技术短视频矩阵剪辑系统开发来聊聊 短视频矩阵系统经过315大会以后&#xff0c;很多违规的技术开发肯定有筛选到了…