The original poster was asking about the Provider itself, not the scope of what it provides.
sam On Jan 9, 2012 4:45 AM, "unguiculus" <[email protected]> wrote: > Sam, > > This is not quite correct. @Provides methods create unscoped instances > unless they are annotated with a scope annotation (e. g. @Singleton). > I think the documentation on this could be improved. It should > especially be mentioned that scoping is possible. > > http://code.google.com/p/google-guice/wiki/ProvidesMethods > > Reinhard > > > I think the catch is that toProvider(SomeProvider.class) is an unscoped > > provider binding, so each injection of Provider<T> will create a new > > instance of the Provider (I think), so there's no shared state since each > > instance is different. @Provides is analogous to > > toProvider(providerInstance), which in turn is analogous to > > bind(..).toInstance(..), all of which act as singletons and need to be > > thread-safe. > > > > sam > > -- > 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.
