Quick Start
启动服务
$ cd spring-cloud-config-server
$ ../mvnw spring-boot:run
这是一个Spring Boot应用,你可以使用IDE运行该服务。在客户端执行:
$ curl localhost:8888/foo/development
{"name":"development","label":"master","propertySources":[
{"name":"https://github.com/scratches/config-repo/foo-development.properties","source":{"bar":"spam"}},
{"name":"https://github.com/scratches/config-repo/foo.properties","source":{"foo":"bar"}}
]}
克隆git资源库(spring.cloud.config.server.git.uri)是定位属性资源的默认策略,并且使用它去初始化最小的SpringApplication。mini-application’s环境被用来列举属性资源以及通过json方式发布这些属性
HTTP service 使用如下格式
/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties
在这里"application"使用spring.config.name属性注入,"profile"是当前有效的profile(逗号分隔的属性),"label" 是可选的git label(默认为 master)
Spring Cloud Config Server 把git仓库中的配置推送到远程客户端。(下面的配置必须被提供)
spring:
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo