OSGi injection in GlassFish - Now with type safety!

ALT DESCR

While GlassFish 3 and above is built on top of OSGi (Felix by default), it is abstracted away by the HK2 layer and certainly not exposed to developers by default. But if they want to leverage the OSGi capabilities of the runtime, they certainly can.

In addition to everything that was already discussed on how OSGi can be leverage from GlassFish, Siva now introduces in his blog how a GlassFish 3.1 CDI Portable Extension (part of the default distro) offers a type-safe @Inject'ion of OSGi dynamic services without having to manually look-up or bind to it. The @OSGiService CDI qualifier offered here supports a number of attributes for dynamic binding, OSGi discovery criteria, and binding timeout.

Siva's blog entry is well written and illustrated with downloadable Maven projects containing the OSGi service and the WAB-packaged servlet client. Recent GlassFish 3.1 milestone required.

Update: you can now look at the corresponding screencast on YouTube.

Comments:

Post a Comment:
Comments are closed for this entry.