advancedTop 100 Interview Questions
How should environment-specific configuration (dev/staging/prod) be handled for a single containerized Spring Boot image?
Build one immutable image and inject environment-specific configuration externally at runtime via environment variables or Spring profiles activated by an environment variable (`SPRING_PROFILES_ACTIVE`), rather than baking environment-specific config into separate images per environment — this preserves the 'build once, deploy anywhere' principle.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response