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.Driver
Insead 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
Facing issues? Have Questions? Post them here! I am happy to answer!
- Deep Dive into Java 8 Predicate Interface
- Read and Parse XML file using Java DOM Parser [Java Tutorial]
- Java 8 Predicate Functional Interface isEqual() Method Example
- Convert Multidimensional Array toString In Java
- How to read int value using Scanner Class Java
- Spring Boot AI + LLM + Java Code Example
- Write to a File using Java Stream API
- Implementing Bubble Sort Algorithm using Java Program
- How to Fix XmlBeanDefinitionStoreException in Java SpringBoot ApplicationConfig.xml
- YAML Parser using Java Jackson Library Example
- [Fix] java: integer number too large compilation error
- Convert JSON String to Java GSON Object Example
- Read a file using Java 8 Stream
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Pretty Print JSON String in Java Console Output
- Java JDBC with Join Queries Example
- How to Check For Updates on Windows 11 (Step-by-Step)
- [Fix] java.net.MalformedURLException: unknown protocol
- How to display date and time in GMT Timezone in Java
- Error: LinkageError occurred while loading main class UnsupportedClassVersionError [Eclipse Java]
- How to convert a String to Java 8 Stream of Char?
- RabbitMQ Queue Listener Java Spring Boot Code Example
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- Handling NullPointerException with Java Predicate
- How to subscribe nest aware? - Google
- How to locate Python Installation on Windows (10/11) - Windows
- How to use SSH in Windows Terminal - Windows
- Fix - zsh: command not found: conda [macOS] - zsh
- How to install iTerm2 Mac Terminal Alternative - MacOS
- Docker - Incompatible CPU detected - M1/M2 Mac (macOS Sonoma) - Docker
- Open VS Code Command Palette using Keyboard Shortcut - Shortcuts
- [Solved] SharePoint System.IO.FileNotFoundException was unhandled - SharePoint