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.