
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!
- CRUD operations in Spring Boot + JDBC
- Java Check Leap Year - Programs with Code Examples
- [fix] Java JDBC ConnectException: Connection refused
- How to add hours and minutes to Java Instant
- Java Program: Random Number Generator
- Java: The value of the local variable string is not used
- How to get list of all Java versions installed on macOS
- Java SE JDBC with Prepared Statement Parameterized Select Example
- Java + Spring JDBC Template + Gradle Example
- Convert String to LocalDate in Java
- Remove Trailing zeros BigDecimal Java
- Java 8 Predicate Functional Interface isEqual() Method Example
- How to Hardcode Date in Java with Examples
- Java 8: Predicate negate() default Function Example
- Java: Collect Stream as ArrayList or LinkedList
- The Motivation Behind Generics in Java Programming
- How to Add/Subtract Days to the Current Date in Java
- Error: Can not find the tag library descriptor for
- Setting up JUnit 5 dependency with Maven Example
- Run Java Code Every Second
- How to create a tar.gz file using Java
- [Fix] java: integer number too large compilation error
- Java 8: Find the Max value in a List
- Your JBoss Application Server 7 is running However you have not yet added any users to be able to access the admin console
- Convert Java Array to ArrayList Code Example
- How to pip install Python Modules in VSCode - Python
- RabbitMQ Java Spring Boot Application Properties List - Java
- Responsive Web Design with CSS Media Queries: A Beginner's Tutorial [Updated for 2023] - CSS
- Docker Alpine Linux and Apache2 Example - Docker
- How to delete a file using Python code example - Python
- FCM Messages! Testing Notifcation from Microsoft to investigate this problem [Microsoft Teams] - Microsoft
- How to delete all text after a character or string in Notepad++ - NotepadPlusPlus
- Call PHP function on Button click using jquery ajax - PHP