SPRING CONCEPTS
IoC · Inversion of Control
Spring Concepts / IoC · Inversion of Control
IoC gives a container control over object creation and assembly.
Understand the idea
Without a container, a Servlet might construct its service and the service might construct a DAO. With Spring, classes declare their collaborators and the container supplies them. Dependency injection is the mechanism used to wire those collaborators.
A concrete example
Container creates repository
→ supplies repository to TodoService
→ supplies service to TodoControllerIn the application
Spring builds the controller → service → repository object graph when the application starts.
IoC does not mean Spring owns your business logic; it manages the object assembly and lifecycle.
Detailed walkthrough: How Spring creates and connects objects →