SpringBoot启动报错:
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.
报错原因:这是因为更换了最新的MySQL驱动
原先的MySQL连接
spring.datasource.password=root |
spring.datasource.username=root |
spring.datasource.driver-class-name=com.mysql.jdbc.Driver |
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boot?serverTimezone=UTC |
修改后
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
此时启动不再报错 ,然而如果你的MySQL数据库版本低于8.0以下,那么即使报错也不会影响使用,但是高于8.0版本的MySQL数据库必须使用com.mysql.cj.jdbc.Drive
亲测5.7版本报错后,不管不问情况下未出现任何使用异常