“Loading class com.mysql.jdbc.Driver … is deprecated” message

Hello can you explain it to me, why is it instead of using com.mysql.jdbc.Driver I got an error

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.

Your help is much appreciated


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

It isn’t an error; it is a warning (or advisory) message resulting from a


call. Your code continues to run despite the message.

It is mainly telling you that the name of the driver class has changed to com.mysql.cj.jdbc.Driver. So, instead use:


It is also letting you know that since Java 6 (JDBC 4.0) it is usually not necessary to manually load the driver class using Class.forName anyway, because JDBC is now able to load the correct driver itself (provided that the driver .jar is available on the class path).

Method 2

I had the same problem in my Spring Boot application.
I added new parameter to my ‘application.properties’ file:


And this solved my problem.

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x