在本地啓動config,拉取的git的url與配置的不一樣?
解決: 查看配置中 basedir 需要配置本地環境支持的目錄, window 如 E:/config
spring - cloud -server 中配置 application.yml
spring:
cloud:
config:
server:
git:
uri: http://git.xxx
username: xxx
password: xxx
search-paths: /config/** #如果目錄下還有區分目錄 就加上/**
basedir: F:\config-dev # 一定要與當前系統的目錄結構保持一致
default-label: dev # 拉取的分支
config 客戶端配置
spring:
cloud:
config:
discovery:
profile: dev # 切換環境 如 product-dev, product-test, 默認是 product,如果不配置會使用application.yml中配置的spring.profiles.active 的環境
service-id: config # 註冊中心config的服務名