title: Register Olingo servlet without web.xml
body: <p>Is it possible to use the <code>@WebServlet</code> annotation with <a href="http://olingo.apache.org/" rel="nofollow noreferrer">Olingo</a>? I want to avoid creating the entries in our <code>web.xml</code>:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;CarServiceServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
          &lt;param-value&gt;org.apache.olingo.odata2.core.rest.app.ODataApplication&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;org.apache.olingo.odata2.service.factory&lt;/param-name&gt;
          &lt;param-value&gt;com.sample.CarServiceFactory&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;CarServiceServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/CarService.svc/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>The code is taken from the <a href="https://github.com/tzmfreedom/olingo-sample" rel="nofollow noreferrer"><code>olingo-sample</code></a> repository. Perhaps there is a way like <code>@WebInitParams</code> to create the init parameters, but what I have to annotate - the <code>class X extends ODataServiceFactory</code>? Does it work generelly?</p>
  
  <p>EDIT: I am using Olingo V2 and Tomcat 8.</p>