title: DispatcherServlet and web.xml in Spring Boot
body: <p>I'm currently trying to move my project from Java EE to Spring Boot project.
  However, i've been stucked and confused on the part with dispatcher servlet and web.xml and it seems like web.xml is no longer being read by the project anymore. The current project is running on tomcat 7.</p>
  
  <p>In my <code>web.xml</code> file, I have lots of <code>servlet</code>, <code>servlet-mapping</code>, <code>filter</code> and <code>filter mapping</code> and I don't really understand how to do the mapping in the dispatcher.</p>
  
  <p>I've attached a sample of my <code>web.xml</code> below and the version is 2.5.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app metadata-complete="true" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
    &lt;display-name&gt;displayName&lt;/display-name&gt;
    &lt;description&gt;description&lt;/description&gt;
    &lt;resource-ref&gt;
      ...
    &lt;/resource-ref&gt;
    &lt;filter&gt;
      &lt;filter-name&gt;Some Filter Name&lt;/filter-name&gt;
      &lt;filter-class&gt;Some Filter Class&lt;/filter-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;Some Param Name&lt;/param-name&gt;
        &lt;param-value&gt;Some Value&lt;/param-value&gt;
      &lt;/init-param&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;Some Filter Name&lt;/filter-name&gt;
      &lt;url-pattern&gt;Some url-pattern&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;Some Param Name&lt;/param-name&gt;
      &lt;param-value&gt;Some Param Value&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;Some Servlet Name&lt;/servlet-name&gt;
      &lt;servlet-class&gt;Some Servlet Class&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Some Servlet Name&lt;/servlet-name&gt;
      &lt;url-pattern&gt;Some Url Pattern&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Qns:</strong></p>
  
  <ol>
  <li>Should I convert all the stuff in my <code>web.xml</code> to rely on the spring dispatcher, if yes how can I achieve that? </li>
  <li>Is moving away from the <code>web.xml</code> the way to go for spring boot project?</li>
  </ol>
  
  <p>Can anyone please guide me along here? Thanks!!</p>