Quick revision
The short answer
I would treat configuration as code: versioned, reviewed and tested, and validated by every service at startup through typed @ConfigurationProperties so bad values fail fast. Configuration changes would roll out gradually like deployments, with a quick rollback, and secrets would move to a secrets manager with rotation. Finally, I would measure configuration-related incidents as their own category and review them together, so we can see whether the strategy is working.
What to remember
In this answer, we set a long-term strategy for configuration across a company. Configuration is treated as code, with version control, review and pipeline checks. Every service validates typed @ConfigurationProperties at startup and fails fast, so bad values never serve traffic. Changes roll out gradually with quick rollback, secrets move to a secrets manager with rotation, and configuration incidents are measured and reviewed as a category to show whether the strategy works.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would treat configuration as code: versioned, reviewed and tested, and validated by every service at startup through typed @ConfigurationProperties so bad values fail fast. Configuration changes would roll out gradually like deployments, with a quick rollback, and secrets would move to a secrets manager with rotation. Finally, I would measure configuration-related incidents as their own category and review them together, so we can see whether the strategy is working.
Why this question is asked
In many companies, a large share of incidents start with a configuration change rather than a code change: a wrong URL, a timeout set in milliseconds instead of seconds, a feature switched on everywhere at once. Code has a pipeline with reviews, tests and canaries, while configuration is often edited directly, so it bypasses every safety net. Interviewers ask this at a senior level to see whether we can set a strategy that changes how a whole company works, not just fix one service. In this answer, we will recap why configuration is so risky, then go through five parts of the strategy: configuration as code, validation at startup, gradual rollout, secrets management and measurement, and finish with how to introduce it.
1Why Configuration Causes So Many Incidents
Configuration is any value that changes behaviour without changing code: URLs, timeouts, pool sizes, feature switches, credentials. It is risky for three reasons. It changes often, because that is its purpose. It usually has weaker checks than code: a YAML file has no compiler, and a value in a console has no review. And it is often applied everywhere at once, so a mistake reaches every instance of a service in seconds.
So the strategy is not to find a better configuration tool. It is to give configuration the same safety nets that code already has, so the same mistake is caught by a review, a check or a canary before it becomes an incident.
2Configuration as Code
The first rule is that every configuration value that matters lives in version control, and changes go through a pull request with review and an automatic pipeline. That includes application files, deployment manifests and ConfigMaps, and it means no manual edits in production consoles, except an emergency procedure that is logged and followed by a commit.
Version control gives us three things at once: a review before the change, a history of who changed what and why, and rollback by reverting a commit. The pipeline adds tests: schema checks for YAML files, a check that every key the change introduces is a property some service actually reads, and lint rules for known mistakes such as durations without units.
3Validating at Startup and Failing Fast
Every service binds its settings to typed @ConfigurationProperties classes with @Validated and Bean Validation constraints. Typed binding catches wrong types and units; constraints catch values out of range. The service then refuses to start with a message naming the property, its value and the rule it broke.
Notice what failing fast buys us. The bad value never serves traffic: Kubernetes keeps the old pods because the new ones never become ready. The cost of the mistake drops from an incident to a failed deployment. The platform team can make this the default by providing a starter where unknown keys under the company's prefixes are reported, and a template where every new properties class is validated.
4Rolling Out Changes Gradually
A configuration change should travel the same path as a code change: first to a test environment, then to a small part of production, then everywhere, with automatic checks between steps. In practice that means configuration changes trigger a normal rolling deployment, so a canary or a first batch of pods gets the new value, and the rollout halts if error rates or latency rise. Rollback is the same operation in reverse, and it should take minutes, not a search for the old value.
Feature flags are the exception that proves the rule: they are designed for runtime changes, and a good flag service already supports gradual rollout by percentage, targeting and instant switch-off. What we forbid is flipping a flag to 100 percent in one step for a risky change.
- Pull request with reviewschema and lint checks in the pipeline
- Apply to stagingservices validate at startup
- Canary in productiona few pods or one region
- Error rate or latency up?YesRoll back by reverting the commitNoContinue to all instances
4 steps in order. Play them, or step through them one at a time.
5Separating Secrets
Secrets need stronger rules than other configuration, so they leave the configuration files entirely. They live in a secrets manager with access control per service, an audit log of reads, and rotation, ideally automatic, so a leaked credential has a short life. Configuration files and manifests only contain references to secrets. This also removes a common incident cause: a credential that expires or is rotated by hand and not updated in every place it was copied to.
6Measuring and Reviewing Configuration Incidents
A strategy needs a number that tells us whether it works. We tag incidents whose trigger was a configuration change, count them per quarter, and track how long they took to detect and resolve. Reviewing them together, not only one at a time, shows patterns that single postmortems miss: perhaps most come from one system without startup validation, or from manual changes during incidents.
Introducing this across a company works best in steps. I would start with the measurement, because it makes the problem visible and gives teams a reason to change. Then move the riskiest systems first: the shared ones whose configuration affects many services, and the ones with the most incidents. The platform team makes the safe path the easy path, with templates, starters and pipeline checks, so teams adopt it because it saves them work.
7Follow-up questions
What about configuration that must change during an incident?
Keep an emergency path, but make it accountable: a documented procedure, a short list of people who may use it, an automatic record of the change, and a follow-up commit within a day so version control matches reality again. Most emergency changes should be feature flag switches, which are designed for it.
How do you stop teams from bypassing the process?
By making the process faster than the bypass and by removing the bypass where possible. If a reviewed change can be in staging within minutes, few people want console access. Then we remove write permissions on production consoles for normal roles, and incidents caused by manual changes show up in the measured category, which gives the conversation data.
Is startup validation enough to catch bad values?
No. It catches values that are wrong on their own, such as a missing URL or a pool size out of range. It cannot catch values that are valid but wrong for the situation, such as a correct URL for the wrong region. Gradual rollout with monitoring is what catches those, which is why the strategy needs both.
8Conclusion
In this answer, we set a long-term strategy for configuration across a company. Configuration is treated as code, with version control, review and pipeline checks. Every service validates typed @ConfigurationProperties at startup and fails fast, so bad values never serve traffic. Changes roll out gradually with quick rollback, secrets move to a secrets manager with rotation, and configuration incidents are measured and reviewed as a category to show whether the strategy works.
Open with
Configuration fails more often than code mainly because it lacks code's safety nets, so my strategy would be to give it those nets. First, configuration as code: every value that matters lives in version control, changes go through pull requests with review and pipeline checks such as schema validation and unit lint, and production consoles are not edited by hand except through a logged emergency path.
Then, if they want more
Second, fail fast: every service binds its settings to typed ConfigurationProperties with Validated constraints, so a wrong type or an out-of-range value stops the new pods from becoming ready and the old ones keep serving. That turns an incident into a failed deployment.
Third, gradual rollout: a configuration change goes through staging, then a canary in production, with automatic checks on errors and latency, and rollback is reverting a commit. Fourth, secrets go to a secrets manager with access control, audit and rotation, and files only reference them.
Fifth, measurement: I tag incidents triggered by configuration, track their count and time to resolve, and review them together to find patterns. I would introduce it by starting with the measurement, then moving the riskiest shared systems first, and having the platform team make the safe path the easiest one with starters, templates and pipeline checks.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Core technologies
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Configuration errors cause a large share of your production incidents. What long-term...": https://scrivio-interview-library.netlify.app/spring-boot/spring-configuration/f9a78cc179/