Start the server:
$ cd spring-cloud-config-server $.. /MVNW Spring-boot:run
The server is a spring boot application, so you can run it from the IDE instead of liking it (the main class is ConfigServerApplication
). Then try a client:
$ 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 " }} ]}
The default strategy for locating resources is to clone a git repository (in spring.cloud.config.server.git.uri
) and use it to initialize a mini SpringApplication
. A small application is Environment
used to enumerate property sources and publish through JSON endpoints.
The HTTP service has resources in the following format:
/{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{ application}-{profile}.yml /{application}-{profile}.properties /{label}/{ Application}-{profile}.properties
Where "Application" is SpringApplication
injected as in spring.config.name
(that is, the regular spring boot application is typically "application"), the profile is the active profile (or a comma-delimited list of properties), and "label" is an optional git tag (the default is "master ”)。
Spring Cloud Config server provides configuration for remote clients from a git repository (must be provided)
Spring: Cloud: config: server: git: uri:https://github.com/ Spring-cloud-samples/config-repo
Source source technical support for complete projects 1791743380
Spring Cloud config-Quick Start