From 216599ad7ece009e4e8c30621420ea662f6da3d1 Mon Sep 17 00:00:00 2001 From: Yevhen Pekhulia Date: Wed, 13 Sep 2017 10:48:45 +0200 Subject: [PATCH] Close Spring context when application is about to close to avoid some issues (faced: when there is scheduler service in the application -> it this case closing process hangs) --- .../mvnsearch/spring/boot/shell/SpringShellApplication.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/mvnsearch/spring/boot/shell/SpringShellApplication.java b/src/main/java/org/mvnsearch/spring/boot/shell/SpringShellApplication.java index f788186..7d27694 100644 --- a/src/main/java/org/mvnsearch/spring/boot/shell/SpringShellApplication.java +++ b/src/main/java/org/mvnsearch/spring/boot/shell/SpringShellApplication.java @@ -1,11 +1,11 @@ package org.mvnsearch.spring.boot.shell; +import java.util.logging.Logger; + import org.springframework.boot.SpringApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.shell.support.logging.HandlerUtils; -import java.util.logging.Logger; - /** * spring shell application * @@ -22,6 +22,7 @@ public static void run(Object[] sources, String[] args) { try { new BootShim(args, ctx).run(); } finally { + ctx.close(); HandlerUtils.flushAllHandlers(Logger.getLogger("")); } }