I have some code like this:

Class A { }


Class B {
        @Inject A a;
}

Class C {

        @Inject A a;
}

Class D {
        @Inject A a;

        @Inject B b;

        @Inject C c;
}

bind(IfA).toProvider(Provider<A>)
...
bind(IfC).toProvider(Provider<C>)

Is it possible to get the injections to work in such way that i get
the following??

a1 = new A()
b1 = new B(a1)
c1 = new C(a1)
d1 = new D(a1, b1, c1)


a2 = new A()
b2 = new B(a2)
c2 = new C(a2)
d2 = new D(a2, b2, c2)

So A and D instances must be 1 to 1, and A instance must be shared
between B,C,D instances

Or maybe any suggestions on how to refactor this in a better way??

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" 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?hl=en.

Reply via email to