Part 2 Cloud native development

4 Externalized configuration management

This chapter focuses on various strategies and tools for configuring Spring applications, particularly in cloud-native settings. It discusses the importance of externalizing configuration to allow for different settings across deployment environments without rebuilding the application. Key topics include:

  1. Configuring Spring with Properties and Profiles: Introduces the concept of using properties and profiles for application configuration, allowing for flexibility across different environments.

  2. External Configuration with Spring Boot: Explains how Spring Boot supports externalized configuration, enabling applications to be configured outside of the codebase.

  3. Spring Cloud Config Server: Describes setting up a centralized configuration server using Spring Cloud Config Server, which stores configuration data in a Git repository, enhancing manageability, and version control of configuration data.

  4. Spring Cloud Config Client: Covers configuring a Spring Boot application using the Spring Cloud Config Client to fetch configuration from the Spring Cloud Config Server.

The chapter underscores the importance of keeping configuration data separate from the application code, highlighting the risks of including sensitive data, like credentials, in the codebase. It also elaborates on the concept of immutability in cloud-native applications, where the application artifact remains unchanged across different environments, with only the configuration data being altered as per the deployment context.

Three main strategies for defining configuration data are summarized:

  • Property Files Packaged with the Application: Useful for specifying supported configuration data and setting default values, primarily for development environments.

  • Environment Variables: Offer portability across different operating systems and are suitable for configuration data that depends on the deployment infrastructure.

  • Configuration Service: Facilitates managing configuration data with features like persistence, auditing, secrets management, and specific application settings like connection pools and feature flags.

The chapter aims to equip readers with the knowledge to configure cloud-native Spring applications effectively, depending on their specific needs and the nature of the configuration data.