[Spring] IoC (Inversion of Control) and DI (Dependency Injection)
IoC
IoC enables a framework to take control of the flow of a program and make calls to our custom code.
The advantages of this architecture are:
- decoupling the execution of a task from its implementation
- making it easier to switch between different implementations
- greater modularity of a program
- greater ease in testing a program by isolating a component or mocking its dependencies, and allowing components to communicate through contracts
Reference
- baeldung - Intro to Inversion of Control and Dependency Injection with Spring