The driver is automatically registered via the SPI and manual loading of the driver class is general

文章目录

    • 报错信息
    • 问题原因
    • 解决方案

报错信息

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

在这里插入图片描述

问题原因

  1. 升级后的mysql驱动类,Driver位置由com.mysql.jdbc.Driver 变为com.mysql.cj.jdbc.Driver
    2.mysql版本过高

解决方案

  1. 将配置文件dataSource.xml中的spring.datasource.driver-class-name=com.mysql.jdbc.Driver修改为如下
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.DriverThe driver is automatically registered via the SPI and manual loading of the driver class is general_第1张图片
    2.将pom.xml 文件中的mysql版本号降低至5系列The driver is automatically registered via the SPI and manual loading of the driver class is general_第2张图片

rerun项目

参考博客link
参考博客link

你可能感兴趣的:(♥Java学习♥)