On 27 July 2010 14:44, openCage <[email protected]> wrote: > For Singletons there is a table at > http://code.google.com/docreader/#p=google-guice&s=google-guice&t=Scopes > under Eager Singletons > describing when Guice constructs objects depending on stage. > > Is there a table for non-singletons? > > I tried to create a scenario, without AOP, where Guice would not > create a class referenced by an injected one; referenced but never > used. > > class A { > @Inject public A ( B b ) {} > } > > But B was always constructed, in all Stages. This suggest that guice > constructs all objects implied to build a object in > injector.getInstance() without any proxies. > This then makes me wonder what 'eager' in case of Singletons means. >
"eager" means it is created as soon as the Injector is created, as part of the Injector initialization - so an eager singleton gets created even if no-one ever requests an instance of it -- > 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]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > -- Cheers, Stuart -- 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.
