4. Quick Start

This quick start walks through using both the server and the client of Spring Cloud Config Server.

First, start the server, as follows:

$ cd spring-cloud-config-server
$ ../mvnw spring-boot:run

The server is a Spring Boot application, so you can run it from your IDE if you prefer to do so (the main class is ConfigServerApplication ).

Next try out a client, as follows:

$ curl localhost:8888/foo/development

The default strategy for locating property sources is to clone a git repository (at spring.cloud.config.server.git.uri ) and use it to initialize a mini SpringApplication . The mini-application’s Environment is used to enumerate property sources and publish them at a JSON endpoint.

The HTTP service has resources in the following form:


where application is injected as the spring.config.name in the SpringApplication (what is normally application in a regular Spring Boot app), profile is an active profile (or comma-separated list of properties), and label is an optional git label (defaults to master .)

Spring Cloud Config Server pulls configuration for remote clients from a git repository (which must be provided), as shown in the following example:

          uri: https://github.com/spring-cloud-samples/config-repo

4.1 Client Side Usage

To use these features in an application, you can build it as a Spring Boot application that depends on spring-cloud-config-client (for an example, see the test cases for the config-client or the sample application). The most convenient way to add the dependency is with a Spring Boot starter org.springframework.cloud:spring-cloud-starter-config . There is also a parent pom and BOM ( spring-cloud-starter-parent ) for Maven users and a Spring IO version management properties file for Gradle and Spring CLI users. The following example shows a typical Maven configuration:


       <relativePath /> <!-- lookup parent from repository -->




   <!-- repositories also needed for snapshots and milestones -->

Now you can create a standard Spring Boot application, such as the following HTTP server:

public class Application {

    public String home() {
        return "Hello World!";

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);


When this HTTP server runs, it picks up the external configuration from the default local config server (if it is running) on port 8888. To modify the startup behavior, you can change the location of the config server by using bootstrap.properties (similar to application.properties but for the bootstrap phase of an application context), as shown in the following example:

spring.cloud.config.uri: http://myconfigserver.com

The bootstrap properties show up in the /env endpoint as a high-priority property source, as shown in the following example.

$ curl localhost:8080/env

A property source called ```configService:<URL of remote repository>/<file name>contains thefooproperty with a value ofbar` and is highest priority.

The URL in the property source name is the git repository, not the config server URL.