Auto-configuration supplies conditional defaults based on dependencies, properties and existing beans. Understand which condition matched before overriding configuration.
Before you start
You should know Java classes, dependency injection and basic HTTP requests. Identify where a call crosses a framework-managed boundary. The snippets illustrate a focused mechanism; database configuration, application wiring and authentication must be supplied by the surrounding application when applicable.
The practical goal is to reason through this situation: Adding a database dependency can enable related configuration when required conditions hold. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Find the bean source
Determine whether application code or auto-configuration registered the unexpected bean.
Step 2: Inspect matched conditions
Check dependencies, properties and existing beans rather than assuming a starter enables everything.
Step 3: Override deliberately
Provide a targeted configuration and verify unrelated defaults still work.
Worked scenario
Adding a database dependency can enable related configuration when required conditions hold.
A database starter appears on the classpath, but missing connection settings or an application-defined bean can change the resulting configuration. Read the condition evaluation information before excluding the entire feature. The useful diagnosis explains which condition matched and why the chosen override changes it.
Common mistake
Assuming every starter activates every feature ignores conditional behavior.
Verify the behavior
Test both the default environment and the explicit override with representative application configuration.
Interview exercise
Diagnose an unexpected bean.
Answer and reasoning
Inspect configuration conditions and the bean definition source, then provide a deliberate override instead of disabling broad features blindly.
Continue learning
Compare the scenario with the Spring Boot interview questions and test your understanding with the Spring Boot MCQs. For terminology and implementation details, consult the reference material.