Dependency injection (DI) means a class does not create its own collaborators — it declares what it needs and the framework supplies them. The IoC (Inversion of Control) container is the part of Spring that builds objects (beans), wires their dependencies, and manages their lifecycle. "Inversion of control" = you hand control of object creation to the container instead of using new.
Declaring and injecting beans
{
PaymentGateway gateway;
{
.gateway = gateway;
}
}
{ }
