title: Specify Custom Application Context
body: <p>We are migrating some of our data services from Jersey 1.x using jersey-spring to Jersey 2.x using jersey-spring3.</p>
  <p>We have a few test classes that inherit from JerseyTest. Some of these classes use custom applicationContext.xml files that are not specified in the web.xml file.</p>
  <p>In Jersey 1.x the test classes that extended JerseyTest could call the super constructor with a WebappDescriptor.Builder to which a context parameter could be passed to set or override the application context path.</p>
  <p>E.g.</p>
  <pre><code>public MyTestClassThatExtendsJerseyTest()
  {
      super(new WebAppDescriptor.Builder(&quot;com.helloworld&quot;)
      .contextParam( &quot;contextConfigLocation&quot;, &quot;classpath:helloContext.xml&quot;)
      .servletClass(SpringServlet.class)
      .contextListenerClass(ContextLoaderListener.class)
      .requestListenerClass(RequestContextListener.class).build());
  }
  </code></pre>
  <p>How can the same be achieved with Jersey 2.x?</p>
  <p>I have combed through the <a href="https://jersey.java.net/documentation/latest/index.html" rel="nofollow noreferrer">API docs</a>, <a href="https://jersey.java.net/apidocs/latest/jersey/index.html" rel="nofollow noreferrer">user guides</a> and some of the <a href="https://github.com/jersey/jersey" rel="nofollow noreferrer">sources</a> but was unable to find an answer.</p>