title: Adding ContextLoaderListener to web.xml in Spring MVC
body: <p>I am new to <em>Spring MVC</em>. I have a web application. I have the following configuration:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;welcome-file-list&gt;
      &lt;welcome-file&gt;list.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;servlet-class&gt;
          org.springframework.web.servlet.DispatcherServlet
      &lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><br>
  Do I need to add the following line to the <em>web.xml</em> file?</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;listener&gt;
      &lt;listener-class&gt;
          org.springframework.web.context.ContextLoaderListener
      &lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre>