Home >Java >javaTutorial >How to solve the problem of com.mysql.cj.jdbc.Driver becoming popular in yml file in Springboot
I built a framework a few days ago, and a strange problem occurred. When configuring the mysql file, com.mysql.cj .jdbc.Driver has been popular. I thought the version was too low, so I upgraded to a higher version, but it was still popular. Finally, I checked online for a long time. The online method said that the version was too low, but I still The dependency package I used before was not working:
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.15</version> </dependency>
Finally I just removed the version number,
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency>
When building and running the springboot project, an error will be reported when adding the database driver.
Before that, you need to add mysql dependency in pom.xml. In the process of seeking solutions to the problem many times, I found a key statement, which is:
I added the version number in the mysql dependency, and this problem is probably caused by inconsistent version numbers, which resulted in this red topic:
At this point, the solution to this problem is obvious.
1. Either comment out the mysql dependency in pom.xml
<!-- 数据库Mysql --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <!--<version>5.7.17</version>--> </dependency>
logging: path: ./log/ spring: datasource: url: jdbc:mysql://localhost:3306/xzs?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver
2. Or the current MySQL version on the computer is too low, reinstall a MySQL version that is more suitable for the development environment.
The above is the detailed content of How to solve the problem of com.mysql.cj.jdbc.Driver becoming popular in yml file in Springboot. For more information, please follow other related articles on the PHP Chinese website!