Card 04/ 06

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.

BeanFactory versus ApplicationContext
AxisBeanFactoryApplicationContext
Singleton beansCreated lazily, on first requestCreated eagerly, at startup
Application eventsNot supportedPublishes and listens for them
InternationalizationNot supportedBuilt-in message resolution
AOP proxying supportMinimalFull 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.