Comment by zxy1256:
I have a related question: When create an injector to create Foo, do we
need a BarDepModule, which is a module for Bar's dependency?
{{{
public class Foo {
private Bar bar;
@Inject
public Foo(Bar bar) {
this.bar = bar;
}
public static void main(String[] argv) {
Injector injector = Guice.getInjector(new BarModule());
Foo foo = injector.getInstance(Foo.class);
}
}
//=====================
public interface Bar {}
public class BarImp {
private BarDep barDep; // Dependency of Bar
@Inject
public Bar(BarDep barDep) {
this.barDep = barDep;
}
}
//=====================
}}}
For more information:
http://code.google.com/p/google-guice/wiki/InjectOnlyDirectDependencies
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.