Dear Arash, I guess the best you can do is put the the B-object construction logic in a Provider and set all it's dependencies from there first of all. And then you're free to inject B into A.
Best wishes, Maciej On Tue, Jun 29, 2010 at 7:55 PM, Jelle Herold <[email protected]> wrote: > > On Jun 24, 2010, at 9:21 PM, Arash Sharif wrote: > >> Hi, >> >> I was wondering if someone could explain to me if this is possible. I >> have Guice instantiate class A that uses regular reflection to >> instantiate class B. In class B I want to inject another class >> instantiated by Guice. However, I cannot. It's as if it looses scope. >> >> The reason I need to do this is to combine a framework that does not >> use Guice, and an application that uses Guice. > > Inject the guice Injector > http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/Injector.html > and then call injectMembers in your B instance. > > HTH > > -- > 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. > > -- Maciej Biłas -- 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.
