Skip to content

basic example of using spring-cloud-config to retrieve configs from a git-backed server

Notifications You must be signed in to change notification settings

bramalingam81/spring-cloud-config-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

spring-cloud-config-example

basic example of using spring-cloud-config to retrieve configs from a git-backed server

Quick Start

Build code

git clone [email protected]:ericdahl/spring-cloud-config-example.git
cd spring-cloud-config-example
mvn clean package

Start Config Server

java -jar server/target/*jar

Load http://localhost:8888/master/development. This displays the config properties which are being retrieved from the git repo defined in bootstrap.yml. This currently is the config directory in this repository.

Start Client App

java -jar client/target/*jar

Load http://localhost:8080 to see the property from the server. Alternatively, you can inspect the properties and their sources from the spring-boot-actuator endpoint at http://localhost:8080/env

Reload configuration from server (at runtime)

Spring Cloud Config has a @RefreshScope mechanism to allow beans to be reinitialized on demand to fetch updated configuration values. The AppController on the client has this annotation, so it will display the new config value once the refresh endpoint is called.

curl -X POST 'http://localhost:8080/refresh'

About

basic example of using spring-cloud-config to retrieve configs from a git-backed server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%