i have a use case where i would like to offer a simple API to extend the functionality of my scala application.
i've spent the last couple of days trying to find a java/scala DI framework or library that does the following for me:
- identifies implementations of an interface/trait on the classpath
- instantiates and injects said implementations ( important feature: all of them ) at a site marked, preferably with an annotation
- the above can't happen in the compiler because i need a plugin architecture where the plugins are not introduced until the JVM starts
- therefore above can happen at JVM start (no hot-swap necessary)
i'm gravitating more and more towards OSGi DS, which i'm a big fan of, except i see it as an overkill due to #4.
i looked at guice, weld, scaladi and macwire, and could not immediately see a simple way to do this. My objective is for the "plugin" authors to not have to be aware of my injection/IoC solution in any way, except for the occasional Annotation ( preferably JSR330 ) At the injection site i am willing to deal with uglier things. :-)
Will i have to roll my own solution here, go with OSGi, or am i missing something trivial in the above mentioned libraries?
ps: i'm trying to steer clear of OSGi mainly because of it's interaction with the application framework i'm using (akka - not sure the bundle/DS lifecycle mixes well with a single actor system)