Hello all 

I have a slight problem with guice injection when using a method annotated 
with  @Provides

example :

@Provides
public Service someService() {
 return new SomeService()
}

I would like to get the current context injected in SomeService..I don't 
understand why Guice doesn't do that automatically, any particular reason 
for that ?

I know I could do something like this (it works):

@Provides
public Service someService(@Inject Injector inj)  {
  SomeService s =  new SomeService()
  inj.injectMembers(s)
  return s
}

But there must be a simpler way.

Thanks

Ps, another question, how to add syntax highlighting ?





-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/d/optout.

Reply via email to