I\'m trying to inject things with Google Guice 2.0 and I have the following structure:
FooAction implements Action
BarAction implements Action
What you want for this is Multibindings. Specifically, you want to bind a Set
(not a List
, but a Set
is probably what you really want anyway) like this:
Multibinder actionBinder = Multibinder.newSetBinder(binder(), Action.class);
actionBinder.addBinding().to(FooAction.class);
actionBinder.addBinding().to(BarAction.class);
Then you can @Inject
the Set
anywhere.