advancedSpring Internals — Bean Lifecycle & Proxies

Why can SmartInitializingSingleton trigger expensive database calls before your application is actually ready?

SmartInitializingSingleton.afterSingletonsInstantiated() runs once ALL singleton beans are created, but before the application context is fully refreshed and ApplicationReadyEvent fires — code here that does eager DB warm-up can run before readiness probes or downstream dependencies expect traffic.

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

Next Step

Continue to What happens when two auto-configurations define the same bean with conflicting conditions?← Back to all Spring Boot & Microservices questions