简体   繁体   中英

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM