0

I have a couple modules

 A extends AbstractModule

 B extends AbstractModule

Which are used to provide class C.

 class C {

    @Inject List<Components> components;
 }

That class C can use A, B or both to be instantiate with a specific information.

For now I have a provider on A module

 @Provider
 List<Components>

Of course I can only have one provider per context, so only A can have it so far. But I need on both because everyone generate his own Components.

I´ve been reading about Multibinders https://github.com/google/guice/wiki/Multibindings

But I would like to know before go for a guice extension, if the guice core provide a mechanism for what I want to do.

Regards.

paul
  • 12,873
  • 23
  • 91
  • 153

1 Answers1

4

Use multibindings. This is exactly what they’re for.

Jesse Wilson
  • 39,078
  • 8
  • 121
  • 128