This was a document I made originally to pin on my bulletin board as a memory aid about how to use the Spring Framework to inject a dependency into another class at run-time.
To use dependency injection:
If you have a bean with a class attribute, Add as a sub-element, add a property tag specifying both name and ref attributes.
<property name="manager" ref="registryManager"/>
Ex: name=” manager” will result in a call to setManager() in MyTestClass
Ex: ref=”registryManager” will look for a bean called registryManager to inject
It is frequent that the name and ref properties appear to have the same values because the setter may have a similar (related) name to the bean being set.