title: Spring Boot graceful shutdown
body: <p>I am developing a Spring Boot application backed by embedded Tomcat and I need to develop a graceful shutdown with the following steps:</p>
  
  <ol>
  <li>stop processing new HTTP requests (stop web container) </li>
  <li>process all already accepted requests</li>
  <li>shutdown Spring ApplicationContext</li>
  </ol>
  
  <p>*do the steps above sequentially (one by one)</p>
  
  <p>How can I achieve this?</p>
  
  <p>P.S. Spring Boot 1.5.20.RELEASE, Java 8</p>