We use a mixed OSGi and non-OSGi environment.
Therefore all our produced JARs are Bundles, to enable deployment and runtime both inside and outside of the OSGi container. Therefore, all our are written without any OSGi API integration, and we use a single OSGi extender bundle to register all services as OSGi services.
I would like to use a single DI solution (i.e. the same configuration file(s)) when wiring the system together both inside and outside of the OSGi container. This, rather effectively, prevents me from using simple blueprint DI.
What would you recommend here?
Is there any best practices collected for this kind of scenario?
Use Spring.
It will obviously work outside of OSGi, and you can use Spring dm to adapt it to work inside of OSGi. It simply requires the addition of an osgi context file to bind beans to/from the service registry.
We have used it in multiple projects for several years for Eclipse RCP apps. It can be used to bind things at the UI level in this particular case as well.