欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Loading class `com.mysql.jdbc.Driver'. This is deprecated 警告异常

程序员文章站 2022-04-05 09:53:29
...

警告: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.
在做springboot整合JDBC时报错
原因:com.mysql.jdbc.Driver已经被弃用
解决办法:用com.mysql.cj.jdbc.Driver代替
application.yml

spring:
  datasource:
    username: root
    password: 123456
    url: jdbc:mysql://192.168.0.110:3306/jdbc
    driver-class-name: com.mysql.cj.jdbc.Driver

在测试:通过
Loading class `com.mysql.jdbc.Driver'. This is deprecated 警告异常