因為SpringCloudConfig相關的配置信息在程序啟動時進行配置信息查詢,這個動作發生在application.yml加載之前。
因此需要把springcloudconfig相關的配置信息配置到bootstrap.yml中。
例:bootstrap.yml中配置如下信息:
spring:
cloud:
config:
server:
git:
uri: https://github.com/xxx/spring-cloud-config-repository.git
username: xxx
password: yyyy
default-label: master
search-paths: config
skip-ssl-validation: true