Oh, and related: Can you give me an example situation where you might use multiple modules to build up an injector?
I'm just trying to gain an intuitive understanding of why Guice works the way it does. Ian. On Friday, January 3, 2014 9:12:37 PM UTC-6, Ian Clarke wrote: > > Ok so, to put it another way (and tell me if I'm wrong), singletons are > local to the injector object? > > So if I have an class X that creates its own injector per-instance, and > that injector contains singletons, I can safely create multiple instances > of X? > > I hope that's true because it makes sense, and it would be tough to use > Guice within libraries otherwise. > > Ian. > > On Friday, January 3, 2014 3:59:11 PM UTC-6, Sam Berlin wrote: >> >> Hey Ian -- >> >> Singletons are global per the injector that created then. That's neither >> per module nor per JVM -- rather, it's per the collection of modules that >> build up the Injector. >> >> sam >> >> >> On Fri, Jan 3, 2014 at 4:48 PM, Ian Clarke <[email protected]> wrote: >> >>> I've been thinking about how to use Guice within a library, but realized >>> that singletons might pose a problem here if they are global to a JVM. >>> >>> My hope is that objects declared with scope SINGLETON are local either >>> to a module, or an instance of Injector. Is this the case? >>> >>> Ian. >>> >>> -- >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/google-guice. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
