Chapter 3. Controlling your configuration with Spring Cloud configuration server

 

This chapter covers

  • Separating service configuration from service code
  • Configuring a Spring Cloud configuration server
  • Integrating a Spring Boot microservice
  • Encrypting sensitive properties

At one point or another, a developer will be forced to separate configuration information from their code. After all, it has been drilled into their heads since school that they shouldn’t hard-code values into the application code. Many developers will use a constants class file in their application to help centralize all their configuration in one place. Application configuration data written directly into the code is often problematic because every time a change to the configuration has to be made the application has to be recompiled and/or redeployed. To avoid this, developers will separate the configuration information from the application code completely. This makes it easy to make changes to configuration without going through a recompile process, but also introduces complexity because you now have another artifact that needs to be managed and deployed with the application.

3.1. On managing configuration (and complexity)

3.1.1. Your configuration management architecture

3.1.2. Implementation choices

3.2. Building our Spring Cloud configuration server

3.2.1. Setting up the Spring Cloud Config Bootstrap class

3.2.2. Using Spring Cloud configuration server with the filesystem

3.3. Integrating Spring Cloud Config with a Spring Boot client

3.3.1. Setting up the licensing service Spring Cloud Config server dependencies

3.3.2. Configuring the licensing service to use Spring Cloud Config

3.3.3. Wiring in a data source using Spring Cloud configuration server

3.3.4. Directly Reading Properties using the @Value Annotation

3.3.5. Using Spring Cloud configuration server with Git

3.3.6. Refreshing your properties using Spring Cloud configuration server

3.4. Protecting sensitive configuration information

3.4.1. Download and install Oracle JCE jars needed for encryption

3.4.2. Setting up an encryption key

3.4.3. Encrypting and decrypting a property

3.4.4. Configure microservices to use encryption on the client side

3.5. Closing thoughts

3.6. Summary

sitemap