【问题集萃】N003:SpringBoot2连接MySQL数据库,启动时报错:The new driver class is `com.mysql.cj.jdbc.Driver'.

连接MySQL数据库,启动时报如下错误

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.

解决对策:按照提示,将配置文件中访问MySQL连接的驱动名称修改如下。

#修改MySQL的驱动名
#spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
发布了16 篇原创文章 · 获赞 12 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/gavinbj/article/details/104046087