Right. That's my fix. I was probing for discussions not solutions. I'm inclined to say that if a class has Singleton on it, it should be honored. However, this impacts existing applications that are attempting to override the Singleton annotation via a Provider. But I would hope that isn't common.
I've honestly never looked at the code, but I would assume that looking for annotations on instances returned from Providers would be simple enough. -bp On Aug 30, 2010, at 7:50 PM, Bob Lee wrote: > Guice only looks at the annotation on the class when it directly creates > instances of that class. > > You want: > > bind(MyInterface.class).toProvider(MyProvider.class).in(Scopes.SINGLETON); > > Thanks, > Bob > > -- > 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.
