Tag Archives: dependency injection

Why I Prefer Constructor Injection over Setter or Property Injection

Magento 2 uses constructor injection as a part of the move towards dependency injection. This is a quick post on why I personally believe constructor injection is the best approach. And to give appropriate credit, it was the core team and individuals like Anton Kril that drove the introduction of dependency injection in Magento. I […]