title: Dispatcher Servlet in Spring Boot
body: <p>In my Spring Boot application with packaging type as war, i am configuring Spring MVC. As i understand we dont have to configure Dispatcher Servlet Manually. However, i old style of web.xml i used to configure Dispatcher Servlet and then i used to pass contextClass and contextConfigLocation as follows</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;description&gt;
      &lt;/description&gt;
      &lt;display-name&gt;DispatcherServlet&lt;/display-name&gt;
      &lt;servlet-name&gt;DispatcherServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;description&gt;contextClass&lt;/description&gt;
          &lt;param-name&gt;contextClass&lt;/param-name&gt;
          &lt;param-value&gt;org.springframework.web.context.support.AnnotationConfigWebApplicationContext&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;description&gt;contextConfigLocation&lt;/description&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;com.xxx.yyy.jdorderspringmvcweb.config.SpringMvcConfig&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;      
  </code></pre>
  
  <p>I belive this was to indicate that SpringMvcConfig (my custom class with spring mvc configuration) is the configuration class for Spring MVC..</p>
  
  <p>However, In spring boot if Dispatcher Servlet is configured Automatically, how can i pass my custom class to dispatcher Servlet ?</p>
  
  <p>In my Spring Boot application, my SpringMvcConfig class extends from WebMvcConfigurerAdapter and is annotated with @Configuration class</p>
  
  <p>Help Needed...</p>