Quick revision
The short answer
Boot 3 no longer reads auto-configurations from spring.factories, so the library's EnableAutoConfiguration entry is never read and nothing fails; the classes are simply never candidates. The fix is to list the classes in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports, annotate them with @AutoConfiguration (which also gives before/after ordering), and verify it with the condition evaluation report and a test that uses ApplicationContextRunner with AutoConfigurations.of(...) plus a check that the imports file lists the class.
What to remember
In this answer, we used the condition report to see that the auto-configuration was never a candidate, traced it to Boot 3 ignoring the EnableAutoConfiguration key in spring.factories, moved the class names into the AutoConfiguration.imports file, switched to @AutoConfiguration with after ordering, and added ApplicationContextRunner tests plus an ImportCandidates check so the wiring is tested, not just the logic.
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.
Boot 3 no longer reads auto-configurations from spring.factories, so the library's EnableAutoConfiguration entry is never read and nothing fails; the classes are simply never candidates. The fix is to list the classes in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports, annotate them with @AutoConfiguration (which also gives before/after ordering), and verify it with the condition evaluation report and a test that uses ApplicationContextRunner with AutoConfigurations.of(...) plus a check that the imports file lists the class.
Why this question is asked
Silent failures are the worst kind during an upgrade. Here nothing throws, every service starts, and the beans the library used to provide are just missing, so the first symptom might be a NoSuchBeanDefinitionException in one service and a quietly disabled feature in another. Interviewers use this scenario to see whether we know how Boot finds auto-configuration and whether we test library wiring rather than only library logic. In this answer, we will confirm the cause with the condition report, see why Boot 3 ignores the file, move the registration, fix the class annotations, and write tests that would have caught it.
1Confirming the Symptom
The first step is to prove that the auto-configuration is not even considered, as opposed to considered and rejected by a condition. We start one consuming service with debug=true, which prints the condition evaluation report, and search for the library's class.
If a condition had failed, the class would appear under negative matches with a reason, such as a missing class or an existing bean. Appearing nowhere means Boot never had it as a candidate. That points straight at registration, not at conditions.
2Why Boot 3 Ignores the Entry
In Boot 2, the library registered its auto-configuration in META-INF/spring.factories under the key org.springframework.boot.autoconfigure.EnableAutoConfiguration. Boot 2.7 introduced a dedicated file for this purpose and deprecated the key, and Boot 3.0 stopped reading it. Boot 3 still reads spring.factories for other extension points, so the file is loaded, but nobody asks it for the EnableAutoConfiguration key any more, and no warning is printed.
- Boot 3 starts the import selector
AutoConfigurationImportSelector - Read AutoConfiguration.imports filesthe library has none
- Library class in any imports file?YesEvaluate its conditionsNoNever a candidate: not in the report
- spring.factories EnableAutoConfigurationnot consulted by Boot 3
4 steps in order. Play them, or step through them one at a time.
So the library compiles, loads and is on the classpath, and its classes are perfectly valid. They are just not on any list that Boot consults.
3Fix 1: Register the Classes in the Imports File
We add the new file to the library's resources and move the class names into it, one per line.
If the library must still support Boot 2.7 consumers for a while, it can keep the spring.factories entry as well; 2.7 reads both, and Boot 3 reads only the new file. Other entries in spring.factories, such as a FailureAnalyzer or an ApplicationListener, stay where they are because Boot 3 still loads those.
4Fix 2: Annotate the Classes With @AutoConfiguration
Boot 2 libraries usually marked auto-configurations with @Configuration and ordered them with @AutoConfigureAfter. We replace those with @AutoConfiguration, which is meant for exactly this, sets proxyBeanMethods to false, and takes the ordering as attributes.
The ordering matters if the library uses @ConditionalOnBean(DataSource.class): without after, it could be evaluated before the DataSource is defined and quietly skip its beans, which would look like the same bug even after the registration fix. Since Boot 4 moved many auto-configurations into new modules and packages, a library that names Boot classes should check them on each major upgrade, or use afterName with a string.
5Verifying With Tests That Would Have Caught It
Two tests close the gap. The first uses ApplicationContextRunner, a lightweight test helper that builds a small context with only the configurations we give it, to check what the auto-configuration does under each condition. The second checks the registration itself, which ApplicationContextRunner does not, because AutoConfigurations.of(...) passes the class in directly rather than reading the imports file.
Notice the last test: it reads the imports files exactly as Boot does, so it would have failed on the old library. A final smoke test in one consuming service, a @SpringBootTest that asserts the AuditClient bean exists, confirms the whole chain on the real classpath, and the condition report should now show AuditAutoConfiguration under positive matches.
6Follow-up questions
Why doesn't Boot 3 log a warning for the old key?
spring.factories is a general file, and Boot 3 simply never looks up that one key. There is no step where it would notice the unused entry. Boot 2.7, the bridge release, was the time when moving was expected, which is why upgrade guides tell library authors to migrate there first.
Could component scanning hide the problem?
Yes, and it is a trap. If a consuming service happens to scan the library's package, the class is picked up as an ordinary configuration and seems to work, but without auto-configuration ordering, so bean conditions may behave differently. The imports file is the correct fix even when scanning seems to help.
How would you find every library with this problem across 150 services?
Search built jars or source repositories for spring.factories files containing the EnableAutoConfiguration key and no matching imports file. A small build check in the shared library pipeline can fail when that combination appears.
7Conclusion
In this answer, we used the condition report to see that the auto-configuration was never a candidate, traced it to Boot 3 ignoring the EnableAutoConfiguration key in spring.factories, moved the class names into the AutoConfiguration.imports file, switched to @AutoConfiguration with after ordering, and added ApplicationContextRunner tests plus an ImportCandidates check so the wiring is tested, not just the logic.
Open with
The reason is that Boot 3 stopped reading auto-configurations from spring.factories. Boot 2.7 introduced the AutoConfiguration.imports file and deprecated the EnableAutoConfiguration key, and 3.0 removed it. Boot still loads spring.factories for things like failure analyzers and listeners, but it never asks for that key, so there's no error, the classes just never become candidates.
Then, if they want more
I'd confirm that by running a consuming service with debug=true: if the class appears in neither positive nor negative matches of the condition evaluation report, it was never considered, so it's registration, not a condition. The fix in the library is to add META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports and list each class, one fully qualified name per line.
If we still have Boot 2.7 consumers, we can keep the old entry too, since 2.7 reads both. I'd also replace @Configuration and @AutoConfigureAfter with @AutoConfiguration(after = ...), because if the library uses @ConditionalOnBean, it must run after the auto-configuration that defines that bean.
To verify, I'd write ApplicationContextRunner tests with AutoConfigurations.of to check the beans and the back-off behaviour, and, because that bypasses the imports file, a test that uses ImportCandidates.load to assert the class is registered. Then a smoke test in one consuming service.
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 "After upgrading a shared library to Boot 3, its auto-configuration is silently ignored...": https://scrivio-interview-library.netlify.app/spring-boot/auto-configuration/cc1a5203ca/