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

报错内容:
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.
Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb_第1张图片

解决办法:
第一步,打开pom.xml,替换dependency。

替换前:
<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <scope>runtime</scope>
</dependency>

操作:去掉<scope>runtime</scope>这部分并且添加版本号<version>5.1.46</version>。

替换后:
<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>5.1.46</version>
</dependency>

第二步,打开application-dev.yml配置文件,更改数据库驱动。

替换前:
driver-class-name: com.mysql.cj.jdbc.Driver

操作:去掉.cj

替换后:
driver-class-name: com.mysql.jdbc.Driver

成功运行:
Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb_第2张图片
相关链接:
IntelliJ IDEA中构建Spring Boot的项目
Spring Boot中的配置文件(application.properties、application.yml与pom.xml)
ORM、JPA、Spring Data JPA和常用的五种访问数据库方式

SpringBoot–页面显示列表功能
SpringBoot–列表添加详情功能
SpringBoot–列表添加新增功能
SpringBoot–列表更新功能
SpringBoot–列表删除功能

SpringBoot的控制层注解(@Controller与@RestController)
SpringBoot的业务层注解(@Resource、@Autowired与@Qualifier)
SpringBoot的映射(@RequestMapping、@GetMapping与@PostMapping)
SpringBoot的函数参数(JavaBean对象、@RequestParam与@RequestBody)
SpringBoot的返回数据(@ResponseBody、返回templates下的网页 与 返回公共网页)

利用postman完成JSON串的发送功能(springboot)
利用postman完成数据的分页查询功能(springboot)
利用postman完成向数据库中添加数据的功能(springboot)

Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
Preparing: insert into user(uuid,username,gender,age,phone,address) values(?,?,?,?,?,?,?)
Could not autowire. No beans of ‘UserMapper‘ type found.
Error starting ApplicationContext. To display the conditions report re-run your application with
Loading class com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is com.mysql.cj.jdb
Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
This application has no explicit mapping for /error, so you are seeing this as a fallback.
BootStrap-SpringBoot的使用过程中前端table表格无法加载出数据。

你可能感兴趣的:(SpringBoot(二),mysql,数据库,java,springboot,经验分享)