You can always inject the injector itself with:

@Inject
void setInjector(Injector injector) {
   ...
}

Your class needs to be managed by guice of course.
Hope that helped.

On Feb 26, 2011, at 8:25 AM, zixzigma wrote:

> Thank You.
> from the source code comments:
> "As of Guice 2.0 you can still use (your subclasses of) {@code 
> GuiceServletContextListener"
> 
> now in Guice 3.0,
> 1- is extending GuiceServletContextListener still the correct way of 
> initializing/bootstrapping injector ?
> 
> 2- can I store injector in final static field, in case I need to directly 
> access Injector
> in a classe other than the one extending GuiceServletContextListener ?
> (I do not intend to pass around Injector all the time,
> but need direct access to injector in one class other than 
> GuiceServletContextListener)
> 
> please see my code below, 
> do you think this is wrong ? can you suggest anything that I can improve ?
> http://pastebin.com/Uxs2tjrG
> 
> Thank You
> 
> -- 
> 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.

Reply via email to