Card 03/ 06

ConceptDifficulty: Intermediate1 min

BeanFactory Is the Root; ApplicationContext Is What You Use

Calling context.getBean(...) on an ApplicationContext is calling it on the interface almost every Spring application actually depends on. It is not, however, the interface underneath all of this — that one is called BeanFactory.

BeanFactory is the root: creating beans, wiring their dependencies, and handing them out on request. ApplicationContext extends it and adds the things a real application wants beyond bare object creation — and you will type ApplicationContext in code you write far more often than BeanFactory, because Spring Boot hands you one directly and nothing asks you to reach past it.

The next card puts the two side by side on the axes that actually differ, since "which one do I use" and "what does the bigger one add" are different questions with different answers.