title: Spring annotation configuration replacement for web.xml configuration
body: <p>I want to replace the configuration of spring contexts in web.xml by an annotation based configuration.</p>
  
  <p>What is the best approach to keep the configuration the same way it is, but no more the separate xml config files in web.xml.</p>
  
  <p>Currently each listed context is loaded after each other, to have some "boot phases". 
  Then there are context files that fill the application context (shared by every servlet) and servlet specific xml configuration files.</p>
  
  <p>The starting point should be a single reference in web.xml to the initial RootContext java class with @Configuration annotation. But how to proceed then, to keep the separate contexts, as they are now?</p>
  
  <p>Here the current web.xml snippet:</p>
  
  <pre><code>&lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/spring/root-context.xml
              /WEB-INF/spring/2nd-context.xml
              /WEB-INF/spring/3rd-context.xml
              /WEB-INF/spring/4th-context.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
  &lt;servlet&gt;
          &lt;servlet-name&gt;springWebapp&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;
                  /WEB-INF/spring/servlet/servlet-context1.xml
                  /WEB-INF/spring/servlet/servlet-context2.xml
              &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'm very grateful for help.</p>