我们有一个Multibinder,我想有两个,所以我们需要@Named注释,所以我们可以做
@Inject @Named("work")
private Set<Runnable> work;
@Inject @Named("otherWork");
private Set<Runnable> otherWork;
有没有办法将Multibinder与名字绑定?
感谢, 迪安
答案 0 :(得分:4)
每this static factory和this helper method:
Multibinder<Runnable> multibinder = Multibinder.newSetBinder(
binder(), Runnable.class, Names.named("work"));