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.
搭建springboot2.27,我默认集成了mysql连接依赖,结果报了上面的异常。
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
这是由于依赖的mysql的版本太高导致。springboot2.27默认依赖的版本如下图:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!--<version>5.1.47</version>
</dependency>
然后就解决了。