On Fri, Sep 12, 2008 at 9:43 AM, Pyrolistical <[EMAIL PROTECTED]> wrote:

>
> Yes, I understand long chains will be hard with DI by hand, but I
> don't understand how Guice makes it easier in long chains.
>
> Say you have a long chain that goes from A -> B -> ... -> F -> G
>
> But H is created not when G is created, but much later in the
> runtime.  So do you have to pass the Injector all the way to G for it
> to create H later?


You can inject Provider<H> into G (no matter how H is bound), and then just
call get() whenever you need an H. Compared to using the Injector directly,
injecting Provider is typesafe.

Bob

--~--~---------~--~----~------------~-------~--~----~
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