Pergunta

We have a Multibinder and would like to have two so we need the @Named annotation so we can do

@Inject @Named("work")
private Set<Runnable> work;
@Inject @Named("otherWork");
private Set<Runnable> otherWork;

IS there a way to bind Multibinder with names?

thanks, Dean

Foi útil?

Solução

Per this static factory and this helper method:

Multibinder<Runnable> multibinder = Multibinder.newSetBinder(
    binder(), Runnable.class, Names.named("work"));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top