Springboot项目中Mybatis升级Mybatis-plus依赖冲突问题
原项目系统中已经引入了 Mybatis 和 pagehelper ,当引入Mybatis-plus 后启动项目报错 SqlSessionFactory 错误,排查原因后为依赖冲突导致,需排除部分jar包
1. Mybatis中
tk.mybatis
mapper-spring-boot-starter
2.1.5
原Mybatis中需排除下面2个依赖
org.mybatis
mybatis
org.mybatis
mybatis-spring
2. pagehelper 中
com.github.pagehelper
pagehelper-spring-boot-starter
1.2.3
需排除下面包
org.mybatis.spring.boot
mybatis-spring-boot-starter
3.引入Mybatis-plus
com.baomidou
mybatis-plus-boot-starter
3.3.2
4.引入autoconfigure
org.mybatis.spring.boot
mybatis-spring-boot-autoconfigure
2.1.4
5. 修改配置文件,将原 mybatis 改成 mybatis-plus
mybatis-plus:
mapper-locations: classpath*:/mapper/*.xml,classpath*:/mapper/**/*.xml
configuration:
mapUnderscoreToCamelCase: true