Inversion of Control
- A design principle: Spring controls object creation and lifecycle.
- Spring has IoC Container, which creates, wires, and manages objects
// if not using ioc container, u need to control when, how, what is created manually
Main interfaces:
BeanFactory (basic)
ApplicationContext (advanced, most used)
What the container does:
- Scans classes (
@Component, @Service, etc.)
- Creates objects (beans)
- Resolves dependencies
- Injects dependencies
- Manages lifecycle (init, destroy, scopes)