解决:Loading class `‘. This is deprecated.

时间:2025-02-12 07:58:51

1.在连接MySQL数据库时候会出现这个报错

Loading class `'. This is deprecated. The new driver class is `'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

2.为什么会出现这个问题?

因为我们当前使用的数据库版本在6.0以上,原来的驱动()已经被废弃了,要进行更换驱动就好了

3.解决办法

spring:
  datasource:
    driver-class-name: 
    url: jdbc:mysql://localhost:3306/test
    username: root
    password: 123456

 在/xml文件中将上面的driver-class-name下的属性改成即可

spring:
  datasource:
    driver-class-name: 
    url: jdbc:mysql://localhost:3306/test
    username: root
    password: 123456

某些童鞋如果不是在/xml文件中配置的driver属性,还可以试试这种方法:

在运行的类中把原驱动

换成

最后如果对你有帮助的话,求一个点赞,谢谢啦!