Guice is a great framework to separate API from implementation and to start modularizing your applications. OSGi is a great framework to load versioned services in their own secured environment and to offer these via an exported API.
Assuming an application has been developed with Guice and that its size now justifies moving to OSGi to convert early modules into new fully-fledge services, what are the driving steps to perform this move?
I am looking for guiding principles, step-by-step to do list, war experience, tips, caveats, etc...
OSGi already offers dependency injection for services when using Declarative Services (DS) (like Felix SCR). This is standard in OSGi, and for portability across different OSGi frameworks DS is the way to go. I think Peaberry is doing exactly what standard DS is doing, but in a Guice way.
If I were to port a Guice application to OSGi, I would keep Guice dependency injection inside each bundle, and use DS for the injection of services between bundles in order to keep the compatibility with all the OSGi frameworks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With