On 8 October 2010 14:59, batkins <[email protected]> wrote:

> I'm not seeing any exceptions or other error messages, and it's a very
> simple construction, so I don't think it's failing.  Is there a way to
> get better information about the bootstrapping process (more logging,
> etc)?
>

are you only creating one injector?  singletons are per-binding,
per-injector

btw, an easy way to get a quick stack trace is to put "new
Throwable().printStackTrace();" in your constructor - that could help

if you turn the JDK logging level to FINE you'll get some trace for the
various startup phases (but not for every injection/create)

On Oct 8, 9:46 am, Willi Schönborn <[email protected]>
> wrote:
> > On 08/10/10 15:35, Jason Winnebeck wrote:> I'm not sure if this is your
> problem or not, but myself and a lot of
> > > other people have gotten confused when starting with guice that
> > > bindings have singleton scope, not classes. For example: if you bind A
> > > to X as singleton and B to X as singleton you will actually get two
> > > instances of X, because you're saying that A and B are singletons, not
> > > X. You need to bind A to X and B to X *then* bind X as singleton if
> > > you want both A and B injections to share the same X instance.
> >
> > That's an excellent point. I encountered another strange situation where
> > guice
> > instantiates a singleton multiple times:
> > In case the bootstrapping fails, guice tries to continue and collect
> > any error that occurs to produce that javac-like error message.
> > During that boot it may happen that your broken singleton is required
> > three times and guice attempts to create it three times.
> >
> >
> >
> > > Jason
> >
> > > On 10/8/2010 9:26 AM, batkins wrote:
> > >> I'm seeing a class bound with asEagerSingleton() constructed 3 times
> > >> (based on a log message in the single, default constructor).  Why is
> > >> this the case?  Do I really have 3 instances running around?
> >
> > >> Thanks
>
> --
> 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.

Reply via email to