Is it accurate to say that dependency injection manually using java (without spring) is nothing but implementing the strategy pattern (as per this example)?
Furthermore, is it correct to say that Spring just provides a declarative way of specifying the dependency as opposed to manual method whereby the dependency need to be created and ‘set’ using java code?
9
Dependency injection (whether done through the constructor or with a DI framework) is one way to implement the strategy pattern, but so is a factory method.
In general, DI frameworks (like the one implemented by Spring) allow you to declare system-wide injection dependencies in a single location.