Microservices

Article 09: Centralized Configuration with Spring Cloud Config

By Utility Zone · 2026-01-28T11:10:21.862573

1. Objective

Learn how to externalize and centralize configuration for all microservices.

2. Key Concepts

  • Centralized configuration
  • Spring Cloud Config Server
  • Git-backed configuration
  • Environment-specific configs

3. Problems Without Centralized Config

  • Config duplication
  • Manual changes per service
  • Restart required for every change

4. Config Server Architecture

[Git Repo] ---> [Config Server] ---> [Microservices]

5. Hands-On: Create Config Server

Dependencies:

  • spring-cloud-config-server

Enable server:

@EnableConfigServer
@SpringBootApplication
public class ConfigServerApplication {
}

application.yml:

server:
  port: 8888
spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/your-repo/config-repo

6. Client Configuration

bootstrap.yml:

spring:
  application:
    name: user-service
  cloud:
    config:
      uri: http://localhost:8888

7. Benefits

  • One source of truth
  • Environment-based configs
  • Easy updates

8. Common Mistakes

  • Storing secrets in Git
  • Not versioning configs

9. Interview Notes

  • Config Server reduces config drift
  • Works well with microservices at scale

10. Summary

Centralized config simplifies configuration management.

11. What’s Next

Secure microservices using JWT.