title: Changing default welcome-page for spring-boot application deployed as a war
body: <p>I was trying to find a way to change the default welcome-page for a spring-boot application that is being deployed as a war in production but I can't find a way to do it without a web.xml file.</p>
  
  <p>According to the documentation we can do it using the EmbeddedServletContainerFactory with this code:</p>
  
  <pre><code>@Bean
  public EmbeddedServletContainerFactory servletContainer() {
  
      TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
  
      TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {
          @Override
          public void customize(Context context) {
              context.addWelcomeFile("/&lt;new welcome file&gt;");
          }
      };
      factory.addContextCustomizers(contextCustomizer);
  
      return factory;
  }
  </code></pre>
  
  <p>Although, as we're creating a war file and deploying it to tomcat and not using the Embedded Tomcat, this isn't doing anything.</p>
  
  <p>Any idea? If we really need to add a web.xml file, how can we do it and still using spring boot? Should we specify the Application bean(with the main method) as the application context for DispatcherServlet? The documentation isn't very clear about that.</p>
  
  <blockquote>
    <p>Older Servlet containers don’t have support for the ServletContextInitializer bootstrap process used in Servlet 3.0. You can still use Spring and Spring Boot in these containers but you are going to need to add a web.xml to your application and configure it to load an ApplicationContext via a DispatcherServlet.</p>
  </blockquote>
  
  <p>Thanks in advance!</p>
  
  <p>Pedro</p>