title: How to inject hk2 servicelocator in a jersey jax-rs app
body: <p>I am migrating a legacy service framework that uses java serialization/reflection to register services and call them as remote endpoints (javabin over http) or local calls seamlessly.
  I have replaced the remote calls as jersey endpoints. Also used hk2 aop based interceptor to recreate some of the interception abilities of current framework. It is working fine when remote client makes a call to the endpoint.
  Now I need to do the same for local calls to service methods and be able to use the <strong>same intercept logic</strong> as the remote service method calls.</p>
  
  <p>(implemented org.glassfish.hk2.api.InterceptionService - based on this article - <a href="https://blog.dejavu.sk/2015/01/21/intercepting-jersey-resource-method-calls/" rel="nofollow noreferrer">https://blog.dejavu.sk/2015/01/21/intercepting-jersey-resource-method-calls/</a>)</p>
  
  <p>I believe if I am able to get the instance of service(jax-rs resource) class from hk2 registry/locator, then method calls will invoke the same registered interceptors. How to achieve it?</p>