Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver

mysql jdbc Driver this is deprecated message
Log Message:

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.

  • In the Spring Boot configuration file application.properties make sure you are using,


    Insead of,

  • If you using applciation.yml file
        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:

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap