The pattern that seems to make the most sense to me is to use assisted injection to create your a's (if they take more than just a b) and then you can add Named annotations to each b binding. Our create a custom annotation, which is my preference since ide's track usage. On Aug 16, 2013 9:40 AM, "Jozsef Hegedus" <[email protected]> wrote:
> Hi, > > I have read (but probably not completely yet understood) Dhanji's book and > I don't know how to solve the following simple problem: > > I have class A that uses(depends on) class B. B has no dependency. > Now I want to create > three different A objects : a1, a2 and a3; > and two different B objects : b1 and b2 > in such a way that > 1) a1 and a2 are injected with b1 > 2) a3 is injected with b2. > > Any suggestions? > > Cheers > > Jozsef > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
