The "proper" way to inject instances created outside of Guice is to inject a MembersInjector<YourType> wherever those instances will be created and call membersInject.injectMembers(theInstance). If you don't know the type ahead of time, you can also inject a plain old Injector and call injector.injectMembers(theInstance).
sam On Thu, Dec 15, 2011 at 7:47 AM, Jochen Mader <[email protected]>wrote: > Nope, not what I need. > I don't have control over the new-call. It's done by the framework. > With spring I can use AspectJ to intercept these calls and do the > weaving. > My question was if something similar exists for Guice. > > Von meinem iPhone gesendet > > Am 15.12.2011 um 11:18 schrieb Aekold <[email protected]>: > > > MyClass instance = new MyClass(); > > requestInjection(instance); > > bind(MyClass.class).toInstance(instance); > > > > On Dec 14, 11:34 am, pflanzenmoerder <[email protected]> > > wrote: > >> Is it possible to inject instances created outside by a framework > >> outside of guice. > >> I know how to do this in spring using AspectJ. > >> Is there something similar for Guice? > >> > >> 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. > > > > -- > 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. > > -- 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.
