Card 06/ 06
Recap: The Bean and the Container
What a bean is, the two container interfaces, and the five-phase lifecycle, with where each was.
The bean and the container come down to the five ideas below, each listed with the card that covers it.
| The idea | Where |
|---|---|
| A bean is an object the container created and manages, whatever its type | Spring Beans: Objects the Container Creates and Manages |
@Component plus component scanning is enough for the container to create a bean | Spring Beans Example: A Bean Found by Component Scanning |
BeanFactory is the root interface; ApplicationContext extends it and is what you use | BeanFactory and ApplicationContext: Spring's Two Container Interfaces |
ApplicationContext creates singletons at startup, so broken wiring fails fast | BeanFactory vs ApplicationContext |
Instantiate, populate, initialise (@PostConstruct), ready, destroy (@PreDestroy) | The Spring Bean Lifecycle: From Creation to Destruction |
The populate phase is where most wiring problems appear, especially when more than one bean could fill the same dependency.
← → move through sections and cards