It does, thanks! On Jun 2, 5:29 pm, Bob Lee <[email protected]> wrote: > Does this work? > > bind(Thing.class).annotatedWith(Named.class).to(DefaultThing.class); > > Bob > > On Thu, Jun 2, 2011 at 4:49 PM, David Garcia <[email protected]>wrote: > > > > > > > > > I have different implementations bound to an interface using @Named, > > how can i get a "default" implementation when none of the bound > > implementations match? > > > For example: > > > configure() { > > > bind(Thing.class).annotatedWith(Names.named("first")).to(FirstThing.class); > > > bind(Thing.class).annotatedWith(Names.named("second")).to(SecondThing.class > > ); > > } > > > if somewhere in the code there is something like: > > > @Inject @Named("third") Thing thirdThing; > > > Is there any way to return a default, say FirstThing.class, instead of > > "third" in case it's not bound??? > > > -- > > 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.
