pagehelper与mybatis-plus冲突的解决办法

背景:

springcloud项目开发新功能时因想使用mybatis-plus,原有功能只使用了mybatis,但在开发时发现某个公共模块使用了com.github.pagehelper,且很多模块都集成了该模块依赖(为了保证原有功能不发生问题,因此pagehelper依赖不能动),若想使用mybatis-plus就会与pagehelper依赖冲突(新功能也是需要依赖之前的公共模块)

以下是新开发功能模块的完整依赖:

XML 复制代码
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>
    <!-- mybatis plus  -->
    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>mybatis-plus-boot-starter</artifactId>
        <version>3.5.2</version>
    </dependency>
    <!--多数据源依赖-->
    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
        <version>3.5.2</version>
    </dependency>
    <!--当前系统公共模块-->
    <dependency>
        <groupId>com.xxx</groupId>
        <artifactId>当前系统的公共模块</artifactId>
        <version>1.0</version>
        <exclusions>  <!--公共模块需要排除以下2个依赖,与mybatis-plus冲突  -->
            <exclusion>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
            </exclusion>
            <exclusion>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!--连接池-->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>1.1.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
</dependencies>

解决冲突的办法就是虽然依赖公共模块,只需要排除掉与mybatis-plus有冲突的jar包即可

相关推荐
dazhong201210 小时前
Mybatis 敏感数据加解密插件完整实现方案
java·数据库·mybatis
努力的小郑12 小时前
MyBatis 两个隐蔽深坑实录:Arrays.asList() 与数字 0 的“离奇失踪”
java·面试·mybatis
cike_y16 小时前
Mybatis增删改查&CURD
java·开发语言·tomcat·mybatis·安全开发
小鸡脚来咯1 天前
Redis与MySQL双写一致性(实战解决方案)
spring·oracle·mybatis
小鸡脚来咯1 天前
Redis三大问题:穿透、击穿、雪崩(实战解析)
java·spring·mybatis
陌路202 天前
redis缓存雪崩,击穿,穿透
redis·缓存·mybatis
学习编程的Kitty2 天前
Redis(1)——持久化
数据库·redis·mybatis
利刃大大2 天前
【Mybatis】Mybatis入门 && 基础操作 && XML配置文件开发 && 多表查询 && 注入问题 && 数据库连接池
xml·数据库·mybatis
野蛮人6号3 天前
黑马微服务报错以及解决前23节课
spring boot·微服务·mybatis
悟能不能悟3 天前
mybatis sql where a=#{a},如果a为null,会返回什么
数据库·sql·mybatis