spring.application.name=config-server
server.port=7001
# git url
spring.cloud.config.server.git.uri=http://code.ync365.com/ync/cloud-config.git
# searchPath
spring.cloud.config.server.git.searchPaths=/
spring.cloud.config.server.git.username=test.com
spring.cloud.config.server.git.password=test
bbs-service-prod.properties 和 bbs-service.properties
内容如下:
# bbs-service-prod.properties
username=prod
# bbs-service.properties
username=default
1.指定配置文件/环境
http://localhost:7001/bbs-service/prod
返回结果:
{"name":"bbs-service","profiles":["prod"],"label":null,"version":"2fa8f3a94d907cb7b43d36d9bcdc760c05738f63","propertySources":[{"name":"http://code.ync365.com/ync/cloud-config.git/bbs-service-prod.properties","source":{"username":"bbs"}},{"name":"http://code.ync365.com/ync/cloud-config.git/bbs-service.properties","source":{"username":"default"}}]}
2.直接访问默认文件
http://localhost:7001/bbs-service.properties
返回结果:
username: default