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

Posted 时光-ing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb相关的知识,希望对你有一定的参考价值。

报错内容:
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.

解决办法:
第一步,打开pom.xml,替换dependency。

替换前:
<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <scope>runtime</scope>
</dependency>

操作:去掉<scope>runtime</scope>这部分并且添加版本号<version>5.1.46</version>。

替换后:
<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>5.1.46</version>
</dependency>

第二步,打开application-dev.yml配置文件,更改数据库驱动。

替换前:
driver-class-name: com.mysql.cj.jdbc.Driver

操作:去掉.cj

替换后:
driver-class-name: com.mysql.jdbc.Driver

成功运行:

以上是关于Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb的主要内容,如果未能解决你的问题,请参考以下文章

解决:Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj(

解决:Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj

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

解决Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.

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

mysql 问题 Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is