Configuration Server

Create config server instance

Spring Cloud Services (SCS) config server tile

Make sure the tile is installed by checking the marketplace

cf marketplace
Getting services from marketplace in org myorg / space development as user...

service                       plans          description
p-config-server               standard       Config Server for Spring Cloud Applications
Git configuration json file

Add this bitbucket/git configuration to a json file to create the service instance. { "git": { "uri": "http://xyz/abc.git", "username": "username", "password": "password", "cloneOnStart": "true", "repos": { "kettering": { "pattern": "amazon*", "uri": "http://xyz/projects/Pivotal Platform/repos/abc" } } }, "count": 3 }

CF CLI command to create config server instance
cf create-service p-config-server standard conf-serv -c config_server.json

p-config-server is the pcf config server tile in marketplace, standard is the plan for the config server (it can be any plan that the tile comes with, usually it is standard), conf-serv - name of the config server instance you are creating that needs to be bound to the application. config_server.json is the json file with the git or svn configuration in the format shown above.

Add this env variable when dealing with non prod installment using Selfsigned certificate
$ cf set-env cook TRUST_CERTS

Setting env variable 'TRUST_CERTS' to '' for app app-name in org myorg / space development as user...
TIP: Use 'cf restage' to ensure your env variable changes take effect

$ cf restage app-name

Create config files in git

Request Paths

Configuration requests use one of the following path formats:


A path includes an application, a profile, and optionally a label.


The name of the application. In a Spring application, this will be derived from or


The name of a profile, or a comma-separated list of profile names. The Config Server’s concept of a “profile” corresponds directly to that of the Spring Profile.


The name of a version marker in the configuration source (the repository). This might be a branch name, a tag name, or a Git commit hash. The value given to the Config Server as a default label (the setting of git.label; see the table of the Pivotal Platform Config Server’s general configuration parameters) can be overridden in a client application by setting the property.

Specify name of the application in bootstrap.yml file
    name: app-name

This application will use a path with the application name, so the Config Server will look in its configuration source for files whose names begin with cook, and return configuration properties from those files.

Using multiple profiles

The application will request configurations for any active profiles. To set profiles as active, you can use the SPRINGPROFILESACTIVE environment variable, set for example in manifest.yml.

  - name: app-name
    host: host-name
      - config-server
      SPRING_PROFILES_ACTIVE: production
View Client Application Configuration

Spring Boot Actuator adds an env endpoint to the application and maps it to /env.

This endpoint displays the application’s profiles and property sources from the Spring ConfigurableEnvironment. (See “Endpoints” in the “Spring Boot Actuator” section of the Spring Boot Reference Guide.)

In the case of an application which is bound to a Config Server service instance, env will display properties provided by the instance.

To use Actuator, you must add the spring-boot-starter-actuator dependency to your project. If using Maven, add to pom.xml:

Client to access the configuration
public class Menu {

  String special;

  public String getSpecial() {
  return special;


Autowire the configuration class and use it

public class Application {

    private Menu menu;

    public String restaurant() {
      return String.format("Today's special is: %s", menu.getSpecial());