Card 04/ 06
All 6 cards
ComparisonDifficulty: Intermediate1 min
BeanFactory and ApplicationContext, Side by Side
Four axes, and on every one ApplicationContext is the superset — which is why nothing here is a real trade-off so much as a map of what you'd be giving up by reaching for the smaller interface on purpose.
| Axis | BeanFactory | ApplicationContext |
|---|---|---|
| Singleton beans | Created lazily, on first request | Created eagerly, at startup |
| Application events | Not supported | Publishes and listens for them |
| Internationalization | Not supported | Built-in message resolution |
| AOP proxying support | Minimal | Full support for annotation-driven proxies |
The eager-versus-lazy row is the one worth carrying forward: because ApplicationContext creates every singleton at startup, a bean with a broken dependency fails the moment the application starts rather than the first time something happens to ask for it. That is a large part of why Spring applications tend to fail fast.
The decision rule is short because the choice mostly isn't one: ApplicationContext is what Spring Boot gives you. Treat BeanFactory as the interface underneath it, not a competing option to reach for.