enleur
09/27/2017, 11:39 AMThe reasons why field injection is frowned upon are following:
You cannot create immutable objects as with constructor injection
Your classes have tight coupling with DI container and cannot be used outside of it
Your classes cannot be instantiated (for example in unit tests) without reflection. You need the DI container to instantiate them, which is more like integration tests
Your real dependencies are hidden from outside and are not reflected in your interface - constructors or methods
It is really easy to have like 10 dependencies. If you were using constructor injection, having constructor with 10 arguments will signal that something is fishy. But you can add injected fields using field injection indefinitely. Having too many dependencies is a red flag that the class usually does more than one thing and it may be a violation of a Single Responsibility Principle.