Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for Guice-to-OSGi guiding principles, experience, tips, etc

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...

like image 566
Jérôme Verstrynge Avatar asked Apr 20 '11 15:04

Jérôme Verstrynge


1 Answers

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.

like image 120
RaduK Avatar answered Oct 26 '22 03:10

RaduK