Instead of creating objects directly, Dependency Injection allows defining how objects should be created. As such, the code doesn’t directly contain connecting components and services together. The configuration file has the information on which services are needed by which components. The IoC container is responsible for connecting components with the appropriate services. Dependency Injection can be used in the following forms:
Construction Injection
Setter Injection