Skip to content

Commit

Permalink
Context close docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jvalkeal committed Sep 12, 2023
1 parent 2e5264a commit af519b5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions spring-shell-docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
** xref:using-shell-customization-logging.adoc[]
** xref:using-shell-customization-commandnotfound.adoc[]
** xref:using-shell-customization-singlecommand.adoc[]
** xref:using-shell-customization-contextclose.adoc[]
* xref:using-shell-execution.adoc[]
* xref:using-shell-testing.adoc[]
** xref:using-shell-testing-basics.adoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[[using-shell-customization-contextclose]]
= Context Close
:page-section-summary-toc: 1

ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]

Command execution logic happens via Spring Boot's `ApplicationRunner` beans.
Normally Spring `ApplicationContext` closes automatically after these runner
beans has been processed unless there is something what keeps it alive like
use of `@EnableScheduling` or generally speaking there are threads which
don't die automatically.

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.

[source, yaml]
----
spring:
shell:
context:
close: true
----

NOTE: This setting is not enabled by default.

0 comments on commit af519b5

Please sign in to comment.