解决:Loading class `com.mysql.jdbc.Driver‘. This is deprecated
问题: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.
解决方式:
报错意思就是说com.mysql.jdbc.Driver这个驱动已经被弃用了,新的驱动为com.mysql.cj.jdbc.Driver,通常是自动注入的。
所以,我们只需要按照提示,将“com.mysql.jdbc.Driver”驱动改为“com.mysql.cj.jdbc.Driver”。
配置如下:
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: xxx
password: xxx
url: jdbc:mysql://localhost:3306/xxxuseUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
原文地址:https://blog.csdn.net/m0_74824574/article/details/145228127
免责声明:本站文章内容转载自网络资源,如侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!