Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

spring-attic/spring-cloud-config-server-mongodb

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
June 10, 2016 00:20
src
March 21, 2019 09:35
June 10, 2016 00:20
March 19, 2019 20:12
March 20, 2019 13:13
April 4, 2022 09:28
March 21, 2019 09:35
March 11, 2019 20:13
March 11, 2019 20:13
March 19, 2019 20:12

spring-cloud-config-server-mongodb is no longer actively maintained by VMware, Inc.

Spring Cloud Config Server MongoDB

build-status Join the chat at https://gitter.im/spring-cloud-incubator/spring-cloud-config-server-mongodb

Spring Cloud Config Server MongoDB enables seamless integration of the regular Spring Cloud Config Server with MongoDB to manage external properties for applications across all environments.

Quick Start

Configure pom.xml, like this:

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

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/libs-snapshot-local</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <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>

Create a standard Spring Boot application, like this:

@SpringBootApplication
@EnableMongoConfigServer
public class Application {

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

}

Configure the application's spring.data.mongodb.* properties in application.yml, like this:

spring:
  data:
    mongodb:
      uri: mongodb://localhost/config-db

Add documents to the config-db mongo database, like this:

use config-db;

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

In the above snippet we've configured properties for an application named gateway having profile prod and label master.

The application-name is identified by the collection's name and a MongoDB document's profile and label values represent the Spring application's profile and label respectively. Note that documents with no profile or label values will have them considered default. All properties must be listed under the source key of the document.

Finally, access these properties by invoking http://localhost:8080/master/gateway-prod.properties. The response would be like this:

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

References

spring-cloud-config

About

No description, website, or topics provided.

Resources

License

Apache-2.0, Apache-2.0 licenses found

Licenses found

Apache-2.0
LICENSE
Apache-2.0
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages