Technical Easy Software Engineer Backend DevOps/SRE

How do profiles and externalised configuration work in Spring Boot?

Practise this question with AI feedback

Record your spoken answer or type your response to receive immediate scoring and STAR improvements.

💡 Suggested Approach & Sample Answer

Externalised configuration: Spring Boot reads properties from many sources and merges them by precedence, so the same JAR runs in every environment.

Common sources, roughly from lowest to highest priority:
- application.yml / application.properties inside the JAR.
- Profile-specific files such as application-prod.yml.
- Files outside the JAR (for example, mounted config in Kubernetes).
- Environment variables, such as SPRING_DATASOURCE_URL.
- Command-line arguments, such as --server.port=9090.

Profiles:
- Activate with spring.profiles.active=prod (property, environment variable or argument).
- Profile files override the defaults; @Profile("dev") limits beans to a profile, for example a fake email sender in dev.
- Profile groups (spring.profiles.group.prod=db-prod,mq-prod) combine several.

Type-safe binding:
- Prefer @ConfigurationProperties(prefix = "app.payment") on a record or class with validation (@Validated) over many @Value annotations.

Secrets: never commit them. Inject them through environment variables or a secret manager (Vault, AWS Secrets Manager, Kubernetes secrets).

🎯 What Interviewers Listen For

How would you answer this in a real interview?

Use our free AI mock practice tool to test your response, analyze speaking pacing, and refine your STAR structure.

🔗 Related Technical Questions