Should i inject only once and pass on the dependencies to other methods
We are using Guice for dependency injection. I have a parent class where I need a dependency and that parent class calls other class methods where EVERY sub-class method needs the same dependency. My idea is that I should use the @Inject annotation only once one the parent class to inject that dependency and once we get that dependency we should pass this as arguments to the other sub-class methods. Is this a correct approach? I dont think we need follow the approach of calling @Inject on the sub classes separately to avoid parameter passing. The approach would only make sense in my opinion if we are passing the dependency several layers down the state and some of the intermediate layers donot need that dependency. Please correct me if I am wrong.