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.