标签:启动 报错 source jdb 配置文件 scope 遇到 com pen
1.添加完MySQL和jdbc约束后,在配置文件内spring.datasource.driver-class-name=com.mysql.jdbc.Driver 报错,显示找不到驱动包,原因是:
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>provided</scope> </dependency>
添加上scope约束,重新导入就好了。然后再次启动项目,仍然报异常:
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.
意思是驱动包内的驱动类换了,改为:spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 后就好了。
标签:启动 报错 source jdb 配置文件 scope 遇到 com pen
原文地址:https://www.cnblogs.com/blog411032/p/10187464.html