Isn't @Provides somewhat an answer. Why are you looking to inject a class into a module. If it's just a resource to build something else, you should do a @Provides method for whatever dependes upon MyClass.
On Oct 4, 7:43 pm, yarco <[email protected]> wrote: > thank you > > On Oct 4, 7:56 am, Sam Berlin <[email protected]> wrote: > > > This is not possible without first constructing some sort of "bootstrap" > > injector. Modules tell the Injector what to do -- there's no way to inject > > them before they're used. See > > alsohttp://code.google.com/p/google-guice/wiki/AvoidConditionalLogicInMod... > > some more information about best practices in modules. > > > sam > > > On Sun, Oct 3, 2010 at 7:49 PM, yarco <[email protected]> wrote: > > > Hi, > > > It is possible to perform injections in modules. > > > Say in: > > > > class Mod extends AbstractModule{ > > > > @Inject > > > MyClass myclass; > > > > .... > > > //use myclass in "this" assuming that Guice would create a new > > > instance for it and inject it to myclass > > > > } > > > I kind of assumed that Guice would Inject myclass (run a default > > > constructor of MyClass) when I created an injector from Mod, but it > > > did not.. > > > > Any help would be appreciated! > > > > -- > > > 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]<google-guice%[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.
