Constructor injection: Dependencies are passed to a client class constructor. An example of the constructor injection was already shown in the preceding Car example code.
Setter injection: Dependencies are provided through setters. The following example code shows an example of the setter injection:
public class Car {
private Owner owner;
public void setOwner(Owner owner) {
this.owner = owner;
}
}