title: Olingo with Spring Boot
body: <p>I am using <a href="https://olingo.apache.org/doc/odata4/tutorials/read/tutorial_read.html" rel="nofollow noreferrer">this tutorial</a> and it works for a simple java web application. Now I want to convert it to Spring Boot. I remove the web.xml and add the following two annotations to DemoServlet</p>
  
  <pre><code>@RestController
  public class DemoServlet extends DispatcherServlet {
      private static final long serialVersionUID = 1L;
      private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
  
      @RequestMapping("/DemoService.svc/*")
      protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
          try {
              // create odata handler and configure it with CsdlEdmProvider and Processor
              OData odata = OData.newInstance();
              ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList&lt;EdmxReference&gt;());
              ODataHttpHandler handler = odata.createHandler(edm);
              handler.register(new DemoEntityCollectionProcessor());
  
              // let the handler do the work
              handler.process(req, resp);
          } catch (RuntimeException e) {
              LOG.error("Server Error occurred in ExampleServlet", e);
              throw new ServletException(e);
          }
      }
  }
  </code></pre>
  
  <p>I also change the HTTPServlet to DispatcherServlet.</p>
  
  <p>Now I am only able to access one end point. i.e. </p>
  
  <pre><code>http://localhost:8080/DemoService.svc/
  </code></pre>
  
  <p>The metadata end point is not working. It returns the service document instead of xml content.</p>
  
  <pre><code>http://localhost:8080/DemoService.svc/$metadata
  </code></pre>
  
  <p>Can somebody explain what is going on here?</p>