SpringBoot整合MyBatis-Plus的一些坑

首先声明本文框架版本为Springboot - 2.x , MyBatis-Plus - 2.x,Mysql - 8.x ,本人在整合过程中遇到一些问题

MyBatis-Plus官方文档地址:

https://baomidou.gitee.io/mybatis-plus-doc/#/quick-start  2.x

https://mp.baomidou.com/guide/  3.x

1. Mysql8.x版本需要设置时区信息,否则报错:(5.x的版本不存在此问题)

 报错信息:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one

解决办法:登录Mysql控制台,执行  1.show variables like '%time_zone%';   2.set global time_zone='+8:00; 重启Springboot项目ok

2. Springboot整合Druid的版本问题:

报错信息:java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider

解决办法:druid-spring-boot-starter版本需要1.1.8以上才支持Springboot2.x

<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>druid-spring-boot-starter</artifactId>
   <version>1.1.9</version>
</dependency>

其实好多问题发生在版本的匹配、依赖jar包之间提供相同类的冲突问题,希望您在评论区能共享更多的问题

猜你喜欢

转载自www.cnblogs.com/404find/p/10740593.html