Skip to content

Commit e6bbee1

Browse files
izeyefmbenhassine
authored andcommitted
Apply Spring Boot's Application Exit support
Closes gh-40
1 parent 6c62fa7 commit e6bbee1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ include::complete/src/main/java/com/example/batchprocessing/BatchProcessingAppli
224224

225225
include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/spring-boot-application-new-path.adoc[]
226226

227+
Note that `SpringApplication.exit()` and `System.exit()` ensure that the JVM exits upon job completion.
228+
See the https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-application-exit[Application Exit section in Spring Boot Reference documentation] for more details.
229+
227230
For demonstration purposes, there is code to create a `JdbcTemplate`, query the database,
228231
and print out the names of people the batch job inserts.
229232

complete/src/main/java/com/example/batchprocessing/BatchProcessingApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
public class BatchProcessingApplication {
88

99
public static void main(String[] args) throws Exception {
10-
SpringApplication.run(BatchProcessingApplication.class, args);
10+
System.exit(SpringApplication.exit(SpringApplication.run(BatchProcessingApplication.class, args)));
1111
}
1212
}

0 commit comments

Comments
 (0)