mybatis和mybatis-plus冲突

一、问题描述

因需要对原有项目进行升级和功能扩展,原项目架构springboot+jpa+mybatis,而现在需要改成springboot+mybatis-plus架构。又因为原来旧项目的分页使用的pagehelper插件,而新架构mybatis-plus又有自己的分页规则。此时需要让项目中原有的东西保持不变,只做增强。
最狗血的问题是 架构竟然成了springboot+mybatis+jpa+mybatis-plus。如果没有经历过这样项目的改造,真的不知道原来bug那么可爱【玛德】。
pom中的依赖

# 父依赖
	<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
# mybatis-plus
	<dependency>
        <groupId>com.baomidou</groupId>
         <artifactId>mybatis-plus-boot-starter</artifactId>
         <version>3.2.0</version>
    </dependency>
# mybatis
 	<dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>2.1.1</version>
    </dependency>      
# pagehelper
 	<dependency>
        <groupId>com.github.pagehelper</groupId>
        <artifactId>pagehelper-spring-boot-starter</artifactId>
        <version>1.2.5</version>
    </dependency>  

如果不是亲身经历,你都不知道这四个东西放在项目里会发生什么事,真的是各种错,玛德

二、解决办法

依赖排除

# 父依赖
	<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
# mybatis-plus
	<dependency>
        <groupId>com.baomidou</groupId>
         <artifactId>mybatis-plus-boot-starter</artifactId>
         <version>3.2.0</version>
    </dependency>
# mybatis
 	<dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>2.1.1</version>
         <exclusions>
        	<exclusion>
        		<groupId>org.mybatis</groupId>
       			<artifactId>mybatis</artifactId>
        	</exclusion>
        	<exclusion>
        		<groupId>org.mybatis</groupId>
       			<artifactId>mybatis-spring</artifactId>
        	</exclusion>
		</exclusions>
    </dependency>      
# pagehelper
 	<dependency>
        <groupId>com.github.pagehelper</groupId>
        <artifactId>pagehelper-spring-boot-starter</artifactId>
        <version>1.2.5</version>
        <exclusions>
        	<exclusion>
        		<groupId>org.mybatis.spring.boot</groupId>
       			<artifactId>mybatis-spring-boot-starter</artifactId>
        	</exclusion>
		</exclusions>
    </dependency>  

如果还启动不起来,项目删了吧,跑路

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

慕木兮人可

感谢支持,勿忘初心

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值