Edy Bourne
Edy Bourne

Reputation: 6207

Understanding Java's injection framework HK2?

I'm converting an OSGi system into a non-OSGi one, and I have a few services that used to be managed by OSGi. I'I'm trying to use HK2 to inject service implementations in a few classes.

I created a custom injection annotation, and created an InjectResolver for it. Then I extended AbstractBinder and used the bind method to link my annotation to my custom injection resolver. Great.

But now, how do I make the system use this binder??

If I were using HK2 with Jersey, I'd register this binder in Jersey's ResoureConfig. But this is not a Jersey application.

How do I tell Hk2 to use my binder so it knows about my custom annotation?

Thanks!

Upvotes: 1

Views: 1778

Answers (1)

Related Questions