users@glassfish.java.net

Hk2 - what is it, how to use it?

From: Alexander Tumin <iamtakingiteasy_at_eientei.org>
Date: Wed, 13 Feb 2013 19:46:28 +0400

Hello, i am looking for some Dependency Injection/Management solution
for OSGi.

At first i have tried iPOJO, but failed then to programmatically create
an iPOJO-fied service which will be publish, binded and injected.

So then i was told that hk2 sub-project of Glassfish could solve this
task, but by just looking at hk2 website ( http://hk2.java.net/ ) you
can't really tell what hk2 actually is.

It is said there that it is an implementation of JSR-330 specification,
but what it does not say is /how/ it was implemented and how to use it
in your OSGi container.

Like, which OSGi bundles do you need to install from hk2 project in
order to get JSR-330 annotations working, driven by hk2 implementation,
where to get them?

Do you need anything but OSGi bundles for it? Like, iPOJO also requires
a maven plugin for work, is hk2 the case too?

Thanks.