Maven工程JDBC错误提示

来源:互联网 发布:电脑没网络手机能连上 编辑:程序博客网 时间:2024/06/06 04:40

Eclipse中的Maven工程,在单元测试(Junit Test)的时候,出现错误代码:

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.

这是因为pom.xml配置的mysql版本相对较新(版本是6.0.6),需要把 jdbc.driverClassName=com.mysql.jdbc.Driver修改为jdbc.driverClassName=com.mysql.cj.jdbc.Driver,修改后进行保存,再次执行Junit Test的时候可以避免出现此错误提示。