springboot连接多数据源出现jdbcUrl is required with driverClassName错误

学习springboot尝试使用mybatis连接多数据源时出现jdbcUrl is required with driverClassName错误
只需要修改yml中的配置即可,将

datasource:
    primary:
      jdbc: jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
      username: zeng
      password: zeng
      driver-class-name: com.mysql.cj.jdbc.Driver
    secondary:
      jdbc: jdbc:mysql://localhost:3306/eesy?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
      username: zeng
      password: zeng
      driver-class-name: com.mysql.cj.jdbc.Driver

修改为

datasource:
    primary:
      jdbc-url: jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
      username: zeng
      password: zeng
      driver-class-name: com.mysql.cj.jdbc.Driver
    secondary:
      jdbc-url: jdbc:mysql://localhost:3306/eesy?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
      username: zeng
      password: zeng
      driver-class-name: com.mysql.cj.jdbc.Driver

即可
注意这里的情况是我没有使用连接池

你可能感兴趣的:(java)