We are working on a new application and we want to use Spring (college project!)
When you are writing a new Spring application, should each and every object be Spring injected?
class A {
...
AHelper helper = new AHelper();
helper.doSomething();
...
}
class AHelper {
public void doSomething(){}
}
In this case, should AHelper be Spring injected into A using a setter? If class A depends on 5 helpers, should all of them be injected? Is that the best practice and if yes what are we getting out of it?
Also, if class AHelper depends on AHelperHelper and that in turn depends on AHelperHelperHelper, should this entire dependency chain be configured in the XML. It just feels wrong to me!