Spring Boot 报错org.springframework.jdbc.datasource.embedded.EmbeddedData

原因:是缺少jdbc相关的jar包,
解决办法:引入spring-jdbc 包

  <!--mysql-->
  <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
  </dependency>

  <!--jdbc-->
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
  </dependency>

还需要在application.yml中配置如下代码:

 spring:
    datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/****?characterEncoding=UTF-8
    username: root
    password: root
    type: com.alibaba.druid.pool.DruidDataSource

最后问题解决!

posted @ 2020-11-10 08:29  鲸鱼zhang  阅读(560)  评论(4编辑  收藏  举报