Private modules is the way to go.
A binding in a private module can see all other bindings in the same private module and all bindings of all non private modules.



On 22.03.2016 21:58, Chris Kessel wrote:
I'm adding two Guice modules, but they both have an @Provides for the same item. They're both 3rd party modules, so I can't modify the code. How do I prevent the collision? I really need each module to use it's own provided version. I guess the equivalent of each living within it's own "scope" where it's provided items aren't visible to the other modules.

Guice.createInjector(Stage.DEVELOPMENT, Arrays.asList(moduleA, moduleB));

I've tried wrapping them in a PrivateModule, but then they don't seem to even see their own @Provides...maybe I'm not understanding how to configure a PrivateModule? I'll actually want expose one specific class from each module to to my module that I'm developing, but my first step was trying to get these two other modules to coexist.

The injector supports creation with multiple modules and it seems like provider collision would happen now and then, so presumably there's some way to deal with that I'm not groking...

Thanks,
Chris

--
You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/26e2e40f-3b26-4ec5-bd20-1c3a2f67fd1e%40googlegroups.com <https://groups.google.com/d/msgid/google-guice/26e2e40f-3b26-4ec5-bd20-1c3a2f67fd1e%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/56F1DAF2.7020608%40gmx.ch.
For more options, visit https://groups.google.com/d/optout.

Reply via email to