赞
踩
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.
因为我们当前使用的数据库版本在6.0以上,原来的驱动(com.mysql.jdbc.Driver)已经被废弃了,要进行更换驱动就好了
- spring:
- datasource:
- driver-class-name: com.mysql.jdbc.Driver
- url: jdbc:mysql://localhost:3306/test
- username: root
- password: 123456
在application.properties/xml文件中将上面的driver-class-name下的属性改成com.mysql.cj.jdbc.Driver即可
- spring:
- datasource:
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://localhost:3306/test
- username: root
- password: 123456
某些童鞋如果不是在application.properties/xml文件中配置的driver属性,还可以试试这种方法:
在运行的类中把原驱动com.mysql.jdbc.Driver
换成com.mysql.cj.jdbc.Driver
最后如果对你有帮助的话,求一个点赞,谢谢啦!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。