【已解决】服务调用另一个服务时出现:Failed to configure a DataSource: ‘url‘ attribute is not specified and no embe

        当一个服务调用另一个服务的时候,出现:配置数据源 url 失败,也就是没有配置数据源。那就好办了。把那一套type、driver-class-name、url、username、password写到application.yml或者application.properties中即可。

注意:driver-class-name:com.mysql.jdbc.Driver还是com.cj.mysql.jdbc.Driver

spring:
  application:
    name: cloud-payment-service  #服务名称
  datasource:  #配置数据源
    type: com.alibaba.druid.pool.DruidDataSource  #数据源类型,以Druid连接池作为连接对象
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=utf-8&useSSL=false
    username: root
    password: 123

猜你喜欢

转载自blog.csdn.net/Sunshineoe/article/details/121124880
今日推荐