Failed to configure a DataSource問題

Failed to configure a DataSource問題

**1、問題:**Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

image-20220402013739793

image-20220402013658923

2、解決措施:

在配置文件中添加數據庫連接配置即可:

image-20220402014320303

#8084表示註冊到zookeeper服務器的支付服務提供者端口號
server:
  port: 8004

#服務別名----註冊zookeeper到註冊中心名稱
spring:
  application:
    name: cloud-payment-service #服務名
  cloud:
    zookeeper:
      connect-string: 47.96.134.215:2181

  datasource:
    type: com.alibaba.druid.pool.DruidDataSource  #當前數據源操作類型
    driver-class-name: com.mysql.cj.jdbc.Driver #數據庫驅動包
    url: jdbc:mysql://localhost:3306/cloud?useunicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
    username: root
    password:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章