In a microservices architecture, externalized configuration means storing application settings outside the application code so they can be changed without rebuilding or redeploying services. Sensitive properties such as passwords, API keys, database credentials, and tokens should be secured using encryption, secret management tools, and controlled access mechanisms.
Instead of storing database credentials separately in each service, all configurations are managed centrally and securely distributed to the services.
Microservices
↓
Config Server
↓
Git Repository
↓
Encrypted Properties
1. Configurations are stored in a central repository.
2. Spring Cloud Config Server exposes configurations.
3. Microservices fetch configurations during startup.
4. Sensitive values are decrypted securely before use.
application-prod.yml
url: jdbc:mysql://prod-db
username: app_user
password: ENC(xyz123abc)
The encrypted password is decrypted at runtime.
1. Spring Cloud Config
2. HashiCorp Vault
3. Kubernetes Secrets
4. Cloud Secret Managers
spring.datasource.password=
${DB_PASSWORD}The actual password is stored outside the application.
Microservice
↓
Spring Cloud Config
↓
HashiCorp Vault
↓
Encrypted Secrets
This approach provides centralized management and enterprise-grade security.
A concise interview answer is: In a microservices architecture, I would use Spring Cloud Config to externalize configuration and maintain centralized configuration management. For sensitive properties such as passwords, API keys, and tokens, I would use secure solutions like HashiCorp Vault, Kubernetes Secrets, or cloud secret managers. Additionally, I would encrypt sensitive values, use environment variables where appropriate, and avoid storing secrets directly in source code or configuration files.
Last updated: 11 November 2026
Previous question: In Spring Boot, how is session management configured and handled, especially in distributed systems?
Next question: Can we create a non-web application in Spring Boot?