title: SpringMVC Configuration
body: <p>I am trying to configure spring-mvc application context but I having some issues running the generated war file in JBoss. I get the following error 
  "java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource"</p>
  
  <p>I can't seem to figure out what is happening to cause the error. I am running springmvc version 5.1.6. Not sure if there is something additional that needs to happen to fix this.</p>
  
  <p>Even after modifying my configuration files as shown, I still get the error.</p>
  
  <p>Web.xml</p>
  
  <pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
                     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_3_0.xsd"
                     version="3.0"&gt;
  &lt;display-name&gt;HelloWorld&lt;/display-name&gt;
  
  &lt;!-- ===================================================== --&gt;
  &lt;!--  1. Create root context with spring listener          --&gt;
  &lt;!--     Remove this means only use servlet contxt         --&gt;
  &lt;!-- ===================================================== --&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;!-- ===================================================== --&gt;
  &lt;!-- Can modify default root context config file           --&gt;
  &lt;!-- =====================================================
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  --&gt;
  
  &lt;!-- ===================================================== --&gt;
  &lt;!--  2. Define servlet with private context               --&gt;
  &lt;!-- ===================================================== --&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher-servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;!-- ================================================= --&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/dispatcher-servlet.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;!-- ===================================================== --&gt;
  &lt;!-- One servlet, the dispatcher, to rule it all           --&gt;
  &lt;!-- ===================================================== --&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher-servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>dispatcher-servlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:beans="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  &lt;!-- register controller in servlet private context --&gt;
  &lt;context:component-scan base-package="hello.controller"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>application.java</p>
  
  <pre class="lang-java prettyprint-override"><code>package hello;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import javax.servlet.http.*;
  
  @SpringBootApplication
  public class Application extends HttpServlet{
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
  }
  
  </code></pre>