Config with Spring Cloud Config

I would like to ask two questions about the Spring Cloud Config.

1) Is it possible to do an implementation of Spring Cloud Config Server to recover the properties of a base mongodb instead of git?

2) The Spring Cloud Config Client Setup automatically update when you have a change in ownership in Spring Cloud Config Server?

Thanks!!!


Spring Cloud Config Server MongoDB is now available on Github.

To get it up and running all you need to do is add the maven config as below, add @EnableMongoConfigServer to your Spring Boot application configuration and configure desired spring.data.mongodb.* properties.

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server-mongodb</artifactId>
        <version>0.0.1.BUILD-SNAPSHOT</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>ojo-snapshots</id>
        <name>OJO Snapshots</name>
        <url>https://oss.jfrog.org/artifactory/libs-snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Then you can add configuration documents to MongoDB like this:

db.appname.insert({
   "label": "master",
   "profile": "prod",
   "source": {
        "user": {
            "max-connections": 1,
            "timeout-ms": 3600
        }
    }
});

And access them via http://localhost:8080/master/appname-prod.properties to obtain a response like this:

user.max-connections: 1.0
user.timeout-ms: 3600.0

UPDATE We have upgraded spring-cloud-config-server-mongodb to use spring-boot 1.5.7 snapshots.


  1. Yes, it is possible, pull requests are welcome
  2. There is no push, but you can use spring's @Scheduled to call RefreshEndpoint.refresh() on an interval basis.

Not sure about 1. For 2) You have spring-cloud-bus which can provide push notifications to all the clients automatically when you make a change in the config server. http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html

Following are needed: 1. RabbitMQ/ Redis running locally 2. Add this dependency in config server pom xml. Use Brixton.M5 build.

<parent>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-parent</artifactId>
      <!-- <version>Brixton.BUILD-SNAPSHOT</version> -->
      <version>Brixton.M5</version>
      <relativePath /> 
    </parent>
<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-monitor</artifactId>
        <scope>test</scope>
    </dependency>
     <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bus-amqp</artifactId>
    </dependency>

3. Use the bus dependency in addition to the spring-config-client dependencies you might already have:

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>

4. [POST]http://localhost:/monitor?path= - this should push notifications to the clients. Alternately you can use a github webhook to post automatically where there is a change in the file.

You can refer to the post here