Dependency injection (DI) is a design pattern used in software engineering. Instead of a class creating its dependencies, these dependencies are provided to the class by an external entity, often referred to as an injector. By definition, the main goal of a pattern is the possibility to solve a problem. In other words, by applying a pattern we may resolve an issue. It is like a template that must be populated by details to be applied but it is helpful and provides a solution skeleton.
What conditions must be met to consider applying dependency injection?