title: How to inject dependency into JerseyTest?
body: <p>I want to inject <code>MyService</code> directly into my JerseyTest using CDI. Is it possible? <code>MyService</code> is succcefull injected into <code>MyResource</code> but I get NullPointerException when I try to access it from MyJerseyTest.</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MyResourceTest extends JerseyTest {
  
    @Inject
    MyService myService;
  
    private Weld weld;
  
    @Override
    protected Application configure() {
      Properties props = System.getProperties();
      props.setProperty("org.jboss.weld.se.archive.isolation", "false");
  
      weld = new Weld();
      weld.initialize();
  
      return new ResourceConfig(MyResource.class);
    }
  
    @Override
    public void tearDown() throws Exception {
      weld.shutdown();
      super.tearDown();
    }
  
    @Test
    public void testGetPersonsCount() {
      myService.doSomething();  // NullPointerException here
  
      // ...
  
    }
  
  }
  </code></pre>