
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.
The above message is to let you know that the class com.mysql.jdbc.Driver is deprecated and you should be using com.mysql.cj.jdbc.Driver instead in your project.
It's important to note that the newer driver class is automatically registered via the Service Provider Interface (SPI) and you generally do not need to manually load the driver class.
To remove this message in your Spring Boot application, you can do the following:
Make sure you are using the proper dependency for mySQL in your pom.xml or build.gradle file.
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.x.xx</version> </dependency>In the Spring Boot configuration file application.properties make sure you are using,
spring.datasource.driver-class-name=com.mysql.cj.jdbc.DriverInsead of,
spring.datasource.driver-class-name=com.mysql.jdbc.Driver- If you using applciation.yml file
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver
Read more:
You can read more about the com.mysql.jdbc.Driver being deprecation and the usage of com.mysql.cj.jdbc.Driver in the below links:
- MySQL Connector/J Release Notes: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-news-8-0-0.html
- MySQL Connector/J Configuration Properties: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html
- MySQL Connector/J Migration Guide: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-installing-upgrading-8-0.html
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!