The full picture
🎬 How the IoC container builds your app
1 / 6Startup: component scanning parses @Component/@Service/@Repository classes and @Bean methods in @Configuration classes.
- BeanDefinition = metadata (class, scope, constructor args, lazy flag) — the container's plan.
@Componentscanning,@Beanmethods, and imports all funnel into the same registry. - Two post-processor families: BeanFactoryPostProcessor edits definitions before creation; BeanPostProcessor intercepts instances during creation. Mixing them up is a classic interview trap.
- Eager by default: singletons are created at startup — failures surface at boot, not at 3am on first request.
@Lazytrades boot time for runtime risk. - Benefits framing: testability (inject fakes), decoupled construction (composition root), lifecycle & scopes handled, and a single interception point for cross-cutting concerns.