There are three basic DI patterns that describe how to inject a dependency:
- Constructor Injection, is the act of statically defining the list of required Dependencies by specifying them as parameters to the class's constructor.
- Property Injection (a.k.a. Setter Injection), statically defines an optional dependency using a property, when there already is a good Local Default.
- Method Injection, allows supplying a consumer with a dependency by passing it in as method parameter, where this method is called outside the Composition Root
Martin Fowler however alo defined Interface Injection. This might seem like another form of DI, but it is in fact just a form of either Property Injection or Method Injection, where the property or method is part of the class's Abstraction. Interface Injection is to my knowledge not commonly used terminology.
Dependency Injection Principles, Practices, and Patterns describes that injection methods should always be placed on the Abstraction. When such injection method is implemented solely on the implementation, it means only the Composition Root can access them, but the book states:
Method Injection is unsuited to be used within the Composition Root. Within a Composition Root, Method Injection can be used to initialize a previously constructed class with its Dependencies. Doing so however leads to Temporal Coupling and is for that reason highly discouraged (§ 4.3.2).
Property Injection on the other hand, is typically solely used on the implementation rather than the Abstraction. That's because in the case of Property Injection it is the Composition Root that will set that dependency.
Interface Injection, as Fowler describes it, seems to be primarily used to initialize a component, but as stated above, that leads to Temporal Couping and should therefore be prevented. Either use Constructor Injection or use Method Injection without storing the dependency.
To get a better understanding of DI, you should read the freely available chapter 1 of that book.