Scrivio Interview library
ScenarioAdvanced5 min read · updated 12 November 2026

Incidents show that services behave differently in production because an auto-configuration silently activated or backed off after a dependency change. What fleet-wide practice would you introduce to catch this before deploy?

I would make the condition evaluation report a build artifact: every service build starts its application context in CI with production-like configuration, saves the conditions report, and diffs its positive and negative matches against the previous release. Any change is flagged for review, together with a diff of the dependency tree, and each service type has a documented list of the auto-configurations it is expected to have.

Why this question is asked

Auto-configuration is quiet by design. When a dependency upgrade adds a jar to the classpath or removes a bean that a condition was looking for, Boot changes what it configures without a warning, and the first sign may be a production incident. Interviewers ask this at senior level because the fix is not a code change in one service but a practice across many. In this answer, we will recap why auto-configuration changes silently, then build the practice step by step: capture the report in CI, diff it, review new dependencies, start the context with production-like settings, and document what each kind of service should look like.

1Why Auto-configuration Changes Without a Warning

Every auto-configuration in Spring Boot is guarded by conditions. @ConditionalOnClass activates it when a class is on the classpath, @ConditionalOnMissingBean backs it off when we define our own bean, and @ConditionalOnProperty ties it to a setting. None of these is visible in our code. So when a library upgrade brings in, say, a caching jar as a transitive dependency, a cache manager may appear. When a teammate adds a custom ObjectMapper bean, Boot's own one backs off, and so do the spring.jackson properties.

Neither change fails the build or the tests, because the application still starts. It just behaves differently. That is the class of problem the incidents describe, and it means we need to compare what Boot decided, build by build.

2Capturing the Report in CI

The condition evaluation report is available inside the application as the ConditionEvaluationReport object, the same data the conditions actuator endpoint serves. A small test in the shared test library can start the context and write the report to a file that becomes a build artifact.

Java
@SpringBootTest
@ActiveProfiles("ci-prodlike")
class ConditionsSnapshotTest {
@Autowired ConfigurableApplicationContext context;
@Test
void writeConditionsReport() throws IOException {
var report = ConditionEvaluationReport.get(context.getBeanFactory());
var lines = new TreeSet<String>();
report.getConditionAndOutcomesBySource().forEach((source, outcomes) ->
lines.add((outcomes.isFullMatch() ? "+ " : "- ") + source));
Files.write(Path.of("build/conditions.txt"), lines); // + ...DataSourceAutoConfiguration
}
}

Sorting the lines makes the file stable, so a diff shows only real changes. A plus sign marks a positive match and a minus sign a negative one. Notice the profile: the test must start with configuration close to production, otherwise property conditions will not match the way they do in production and the snapshot is misleading.

3Diffing Against the Previous Release

The pipeline keeps the conditions file of the last released build. On every new build, it compares the two. An empty diff means Boot made the same decisions. A non-empty diff does not fail the build, because changes are often intended, but it is posted on the pull request and needs an explicit approval from the service owner.

SQL
--- conditions-release-41.txt
+++ conditions-build-42.txt
- - ...cache.CacheAutoConfiguration
+ + ...cache.CacheAutoConfiguration // a cache manager is now configured
- + ...jackson.JacksonAutoConfiguration
+ - ...jackson.JacksonAutoConfiguration // our own ObjectMapper made it back off
Step throughThe conditions check in each build
  1. Build the servicewith the new dependency versions
  2. Start the context in CIproduction-like profile
  3. Save conditions and dependency treeas build artifacts
  4. Different from last release?
    YesPost the diff and ask for reviewNoContinue the pipeline
  5. Owner approves the changereason recorded in the pull request

5 steps in order. Play them, or step through them one at a time.

Two lines like these would have prevented both kinds of incident. The reviewer sees that caching switched on and asks why, and sees that Jackson backed off and checks the JSON contract. The value is that the question is asked before deploy instead of during an incident.

4Treating New Transitive Starters as a Review Item

Most silent activations start in the dependency tree, not the code. So the same pipeline also saves the resolved dependency list (mvn dependency:list or gradle dependencies) and diffs it. A new artifact whose name contains spring-boot-starter, or a new jar that a known auto-configuration looks for, is highlighted. Tools such as Renovate or Dependabot, or a dependency diff plugin, make the change visible in the pull request itself.

This catches the cause one step earlier. When the conditions diff says a configuration activated, the dependency diff usually says which upgrade brought the jar in, and the reviewer can decide whether to accept it, exclude the dependency or exclude the configuration.

5Documenting the Expected Shape of Each Service Type

Diffs show changes, but someone has to know what is normal. The platform guide should list, for each kind of service, the auto-configurations it is expected to have. A REST service with PostgreSQL would expect web MVC, Jackson, DataSource, JPA, Flyway and actuator configurations, and would not expect messaging or a second data store. A Kafka consumer would expect Kafka and no web server.

Better still, the expected list can be a shared test that every service of that type runs, asserting that certain configurations are present and others absent. Then the guide and the check cannot drift apart, and a new team gets a working baseline on day one.

Expected auto-configurations by service type
Service typeExpectedFlag if present
REST + PostgreSQLWebMvc, Jackson, DataSource, JPA, FlywayKafka, Mongo, Redis
Kafka consumerKafka, Jackson, DataSourceWebMvc server, Mongo
Batch jobBatch, DataSource, JPAWebMvc server, Kafka listeners
A small table in the platform guide, turned into a shared test per service type.

6Follow-up questions

Why not fail the build whenever the conditions report changes?

Because many changes are intended, such as adding a feature, and a check that fails on every intended change gets turned off quickly. A visible diff with a required approval keeps people thinking without blocking them. For changes that must never happen, such as a second data store in a regulated service, a hard failing assertion is fine.

Can we rely on the conditions actuator endpoint in production instead?

It is useful for investigating a running service, but by then the change is already deployed. The goal here is to catch the change before deploy, so the report has to be produced in CI. Exposing the endpoint in production also needs care, because it reveals internals; keep it behind management security.

What does production-like configuration mean for the CI context?

The same profiles and feature properties as production, with real infrastructure replaced by Testcontainers or local stand-ins and secrets replaced by dummy values. Property conditions must see the same values, otherwise the report will differ from what production actually does.

7Conclusion

In this answer, we saw why auto-configuration can change silently: its conditions depend on the classpath, our beans and properties, none of which shows in code. To catch those changes before deploy, we save the condition evaluation report in CI from a context started with production-like configuration, diff positive and negative matches against the last release, review new transitive starters through a dependency diff, and document the expected auto-configurations for each type of service as a shared test.

What to say in the interviewAbout 80 seconds aloud

Open with

The problem is that auto-configuration decisions are invisible in code, so I would make them visible in every build. In CI, each service starts its application context with a production-like profile, and a shared test writes the ConditionEvaluationReport, the same data as the conditions endpoint, as a sorted file of positive and negative matches.

Then, if they want more

The pipeline diffs that file against the last released build. A change does not fail the build, but it is posted on the pull request and the owner has to approve it, so someone sees that a cache manager just switched on or that JacksonAutoConfiguration backed off.

Alongside it, I would diff the resolved dependency tree, because most silent activations start with a new transitive starter, and treat any new starter as a review item. Starting the context with production-like settings matters, because property conditions must match the way they do in production, and it also surfaces back-off changes early.

Finally, I would document the expected auto-configurations for each service type in the platform guide and turn that list into a shared test, so a REST service that suddenly configures Kafka gets flagged automatically.

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 Boot reference
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 "Incidents show that services behave differently in production because an...": https://scrivio-interview-library.netlify.app/spring-boot/auto-configuration/863224ecf3/