Spring Cloud Config Server

Remote files from Config server have precedence over local one.

The Environment resources are parameterized by three variables:

  • {application}, which maps to spring.application.name on the client side.
  • {profile}, which maps to spring.profiles.active on the client (comma-separated list).
  • {label}, which is a server side feature labelling a “versioned” set of config files. (can be something like git branch e.g: master)

Therefore properties in configuration files in config server have precedence according with file names (lower to higher):

  • application.properties
  • <service>.properties
  • <service>-<profile>.properties

Client application will query properties from config server using the following syntax:

http://config-server:port/<application>/<profile>/<label>

Refresh can be invoked from in client using actuator refresh.

POST: http://service:port/actuator/refresh

(endpoint must exposed in web interface, management.endpoints.web.exposure.include=refresh )

However in order to refresh values, beans have to be declared with @RefreshScope

Spring Cloud Bus

Allow to propagate events, like refresh, through an MQ.

 POST: http://service:port/actuator/bus-refresh 

(endpoint must exposed in web interface, management.endpoints.web.exposure.include=bus-refresh )

References

https://cloud.spring.io/spring-cloud-config/reference/html/