title: How to shut down a Spring Boot command-line application
body: <p>I am building a Command Line java application using Spring Boot to get it working quickly.</p>
  
  <p>The application loads different types of files (for example CSV) and loads them into a Cassandra Database. It does NOT use any web components, it is not a web application.</p>
  
  <p>The problem I am having is to stop the application when the work is done. I am using the Spring CommandLineRunner interface with a <code>@Component</code> to run the tasks, as shown below, but when the work is completed the application does not stop, it keeps running for some reason and I can't find a way to stop it.</p>
  
  <pre><code>@Component
  public class OneTimeRunner implements CommandLineRunner {
  
      @Autowired
      private CassandraOperations cassandra;
  
      @Autowired
      private ConfigurableApplicationContext context;
  
      @Override
      public void run(String... args) throws Exception {
          // do some work here and then quit
          context.close();
      }
  }
  </code></pre>
  
  <p><strong>UPDATE</strong>: the problem seems to be <code>spring-cassandra</code>, since there is nothing else in the project. Does anyone know why it keeps threads running in the background that prevent the application from stopping?</p>
  
  <p><strong>UPDATE</strong>: the problem disappeared by updating to the latest spring boot version.</p>