Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class

378 阅读1分钟

异常错误:

Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

加载类“ com.mysql.jdbc.Driver”。 不推荐使用。 新的驱动程序类为“ com.mysql.cj.jdbc.Driver”。 通过SPI自动注册驱动程序,通常不需要手动加载驱动程序类。

问题原因 这个问题 是在我整合springboot.mybatis.mysql项目过程中出现的,用了最新的mysql 连接驱动所以出错了

spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=GMT%2B8&useSSL=true
    username: root
    password: sm1208

现在按照最新官方提示支持将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver即可

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=GMT%2B8&useSSL=true
    username: root
    password: sm1208