That's because bind().in() is a correct binding. You can bind a class
directly in a scope or bind an interface to a class, in a scope.
Guice should probably check for abstract types being bound with
bind().in()--i.e. without the to(), rather than throw NPE if that is what
was happening.
Dhanji.
On Wed, Sep 24, 2008 at 2:36 PM, Gili <[EMAIL PROTECTED]> wrote:
>
> I got it!
>
> The binding was missing to(). If you remove the Scope guice is smart
> enough to complain about it but it seems that Scopes.SINGLETON doesn't
> expect this error. I have updated the bug report with this
> information.
>
> Gili
>
> On Sep 24, 12:09 am, Gili <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I have narrowed the testcase forhttp://
> code.google.com/p/google-guice/issues/detail?id=249
> > to the following lines of code:
> >
> > The module contains:
> >
> > binder.bind(Key.get(PermanentRedirect.class,
> > Names.named("RedirectMain"))).in(Scopes.SINGLETON);
> >
> > The application invokes:
> >
> > injector.getInstance(Key.get(PermanentRedirect.class,
> > Names.named("RedirectMain")));
> >
> > and the exception is thrown. If I remove "in(Scopes.SINGLETON)" I get
> > a difference exception:
> >
> > com.google.inject.ConfigurationException: Missing binding to
> > PermanentRedirect annotated with
> > @com.google.inject.name.Named(value=RedirectMain).
> >
> > Can someone help me find a workaround or at least help me understand
> > what is going wrong inside Guice's code?
> >
> > Thank you,
> > Gili
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---