title: Using multiple dispatcher servlets / web contexts with spring boot
body: <p>I created a spring boot application with a parent context (services) and child context (spring-webmvc controllers):</p>
  <pre><code>@Configuration
  public class MainApiApplication {
  
      public static void main(String[] args) {
          new SpringApplicationBuilder()
                  .parent(Services.class)
                  .child(ApiOne.class, MainApiApplication.class)
                  .run(args);
      }
  
      @Bean
      public EmbeddedServletContainerFactory servletContainer() {
          return new TomcatEmbeddedServletContainerFactory();
      }
  
  }
  </code></pre>
  <p>Now I want to add another client context (and DispatcherServlet) for my <code>ApiTwo.class</code> configuration. I think I have to do two things:</p>
  <ol>
  <li>Move the <code>servletContainer</code> (thus the MainApiApplication.class configuration) out of the child context and</li>
  <li>add a path mapping <code>/one/ -&gt; ApiOne.class</code> and <code>/two/ ApiTwo.class</code></li>
  </ol>
  <p>What is the spring boot way to do it?</p>