Context Close

Command execution logic happens via Spring Boot’s ApplicationRunner beans. After these runners finish, the JVM can exit when no non-daemon threads remain, and Spring Boot’s shutdown hook closes the ApplicationContext. Background threads, such as scheduling threads, can keep the application running.

It is possible to add configuration property spring.shell.context.close which registers ApplicationListener for ApplicationReadyEvent and requests context close after shell has completed its execution logic.

spring:
  shell:
    context:
      close: true
This setting is not enabled by default.