users@jersey.java.net

[Jersey] getting the hk2 service locator

From: Aris Alexis <aris.alexis.gia_at_gmail.com>
Date: Wed, 29 Jul 2015 10:49:03 +0200

I have a scenario that Jersey 2.13 (with HK2 as DI) is loaded up in Tomcat
and on the same JVM (I start it up from a startup servlet) a netty-socket-io
server <https://github.com/mrniko/netty-socketio> is running. I want this
second server's methods to have access to the injected classes that the
rest of my web app is using and I wouldn't like to introduce another
dependency injection framework just for that.

I read that you can get a ServiceLocatorProvider in Jersey for doing this
here
<https://jersey.java.net/apidocs/2.6/jersey/org/glassfish/jersey/ServiceLocatorProvider.html>
but
you need to have a context provided while my methods are completely
separated.
Best Regards,
Aris Giachnis