Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Guice and OSGi services

What's the current situation with integrating Guice and OSGi? I.e. exposing OSGi services from Guice, injecting them, etc.

Peaberry's main page mentions "The Guice trunk (which will become 2.0)", but 1.2 seems up-to-date, since it fixes http://code.google.com/p/peaberry/issues/detail?id=58. Its author has switched Sisu, but it doesn't seem to be released yet. Any others?

like image 550
Alexey Romanov Avatar asked Apr 12 '12 12:04

Alexey Romanov


1 Answers

The integration of Guice 3.0 and Peaberry 1.2 currently is working like expected. Just the page seems to be a little outdated sind the snippet mentioned above refers to the Guice 2.0 trunk which has been superseded.

The Bug your referencing is fixed for the 1.2 Peaberry release when you look at the repository history here.

It's true that Sisu is currently developed and it solves (at least how I interpret it) some additional problems that are currently existing with Guice + Peaberry + OSGi (e.g. automatic component scanning and discovery) but it isn't ready yet.

In my opinion Peaberry solves the same integration cases of DI and OSGi that are also solved by Spring Dynamic Modules (now Eclipse Gemini Blueprint) and is therefore very useful. Also I don't think necessarily that the Peaberry project will be abandoned in favor of sisu.

If all you stay true to the OSGi idea of developing independent bundles that are wired through services but you want to use DI inside them, Peaberry currently offers everything you need for that.

The only problem I'm currently facing with that combination is that the official guice-servlet module doesn't seem to play with the OSGi HttpService by default.

like image 185
Johannes Wachter Avatar answered Sep 28 '22 10:09

Johannes Wachter