The Spring IoC Container
How Spring creates and wires beans.
Inversion of Control
Inversion of Control (IoC) means your objects no longer create their own collaborators. Instead, a container constructs them and hands over (injects) their dependencies.
This flips the traditional flow: rather than calling new everywhere, you declare what you need and let the framework wire it up.
The ApplicationContext
Spring’s IoC container is the ApplicationContext. It reads bean definitions, instantiates them, resolves dependencies, and manages their lifecycle from creation to shutdown.
In Spring Boot, SpringApplication.run builds this context for you and keeps it running.
All lessons in this course
- The Spring IoC Container
- Constructor vs Field Injection
- Bean Scopes
- Lifecycle Callbacks