JPE
2016-07-06 21:07:41 UTC
Hi,
I just started looking at Guice to see if it can meet some requirements for
a library I maintain. Assume a jar that describes some interfaces,
core.jar. The implementations of the interfaces will be contained in a
separate jar. There will be several jars that include the implementations,
one for each customer (implA.jar, implB.jar ...). The users of the library
will include one and only one of the implementation jars in their
applications. The implementation jars contain proprietary data so only one
implementation jar will be delivered with the application.
My question is how to perform binding when the api jar will know nothing
about the implementations. I've looked at the docs about Providers and
Modules, but I'm not seeing how binding occurs from the implementation
side.
I've considered using a property or environment variable to indicate the
customer and then using that to map to an implementation class name, and
then using the name to get the class, but that seems like it's defeating
the purpose of Guice/DI.
Any thoughts are welcome. Thanks.
I just started looking at Guice to see if it can meet some requirements for
a library I maintain. Assume a jar that describes some interfaces,
core.jar. The implementations of the interfaces will be contained in a
separate jar. There will be several jars that include the implementations,
one for each customer (implA.jar, implB.jar ...). The users of the library
will include one and only one of the implementation jars in their
applications. The implementation jars contain proprietary data so only one
implementation jar will be delivered with the application.
My question is how to perform binding when the api jar will know nothing
about the implementations. I've looked at the docs about Providers and
Modules, but I'm not seeing how binding occurs from the implementation
side.
I've considered using a property or environment variable to indicate the
customer and then using that to map to an implementation class name, and
then using the name to get the class, but that seems like it's defeating
the purpose of Guice/DI.
Any thoughts are welcome. Thanks.
--
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 google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
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/f8044bea-811c-4398-a1c8-3879dd9f9f08%40googlegroups.com.
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 google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
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/f8044bea-811c-4398-a1c8-3879dd9f9f08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.