title: Spring boot REST application deployed as WAR on tomcat is not working
body: <p>Created a spring boot REST application. </p>
  
  <p><strong>Run as Spring boot app</strong><br>
  While running it as <code>spring boot application</code> in eclipse. It's working great.<br>
  REST API are working with the URL -  <code>http://localhost:8080/schools</code></p>
  
  <p><strong>Deploy as WAR on tomcat</strong></p>
  
  <p>I followed the following steps </p>
  
  <ol>
  <li>Main class extends <code>SpringServletContainerInitializer</code></li>
  </ol>
  
  <pre><code>    @SpringBootApplication
      public class RmsBackendApplication extends SpringServletContainerInitializer {
  
          public static void main(String[] args) {
              SpringApplication.run(RmsBackendApplication.class, args);
          }
      }
  </code></pre>
  
  <ol start="2">
  <li>Added start class entry in <code>pom.xml</code></li>
  </ol>
  
  <pre><code>    &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;start-class&gt;com.codingParkFun.rmsbackend.RmsBackendApplication&lt;/start-class&gt;
      &lt;/properties&gt;
  </code></pre>
  
  <ol start="3">
  <li>Added starter tomcat dependency</li>
  </ol>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <ol start="4">
  <li><p>Few documents say override <code>configure</code> method of <code>SpringServletContainerInitializer</code>. But in my case <code>SpringServletContainerInitializer</code> doesn't have a <code>configure</code> method. I downloaded spring tools 4.0</p></li>
  <li><p>Generated package with <code>maven install</code>. War package is generated with the name <code>rms-0.0.1-SNAPSHOT.war</code></p></li>
  <li><p>Deployed the war package on the tomcat (version <code>9.0.27</code> )</p></li>
  <li><p>Accessing REST API URL - <code>http://localhost:8080/rms-0.0.1-SNAPSHOT/schools</code></p></li>
  </ol>
  
  <p>Output 
  <a href="https://i.stack.imgur.com/bf8G1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bf8G1.png" alt="enter image description here"></a></p>
  
  <ol start="8">
  <li>Tomcat localhost logs are as follow :</li>
  </ol>
  
  <pre><code>09-Nov-2019 11:13:31.013 INFO [main] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
  09-Nov-2019 11:13:32.048 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
  09-Nov-2019 11:13:32.048 INFO [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
  09-Nov-2019 11:13:32.052 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@6231bb88')
  09-Nov-2019 11:16:44.566 INFO [Thread-4] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
  09-Nov-2019 11:16:44.566 INFO [Thread-4] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
  09-Nov-2019 11:19:59.676 INFO [main] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
  09-Nov-2019 11:20:12.722 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
  09-Nov-2019 11:20:12.723 INFO [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
  09-Nov-2019 11:20:12.728 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@2420e962')
  09-Nov-2019 11:27:44.515 INFO [main] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
  09-Nov-2019 11:27:45.490 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
  09-Nov-2019 11:27:45.490 INFO [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
  09-Nov-2019 11:27:45.494 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@1c7da28')
  09-Nov-2019 11:38:48.705 INFO [http-nio-8080-exec-7] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
  </code></pre>
  
  <p>Not sure while the application REST API is not working. Please guide. </p>