From 1626a4919fee144f76549541754b8cfa06fa406e Mon Sep 17 00:00:00 2001 From: Eric Bottard Date: Mon, 10 Oct 2016 13:11:26 +0200 Subject: [PATCH] Better manage Bootstrap created objects Fixes https://github.com/spring-projects/spring-shell/issues/96 --- .../java/org/springframework/shell/Bootstrap.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/springframework/shell/Bootstrap.java b/src/main/java/org/springframework/shell/Bootstrap.java index 35d397e4..a700b8fc 100644 --- a/src/main/java/org/springframework/shell/Bootstrap.java +++ b/src/main/java/org/springframework/shell/Bootstrap.java @@ -43,19 +43,14 @@ public class Bootstrap { private final static String[] CONTEXT_PATH = { "classpath*:/META-INF/spring/spring-shell-plugin.xml" }; - private static Bootstrap bootstrap; - - private static StopWatch sw = new StopWatch("Spring Shell"); - - private static CommandLine commandLine; + private CommandLine commandLine; private GenericApplicationContext ctx; public static void main(String[] args) throws IOException { - sw.start(); ExitShellRequest exitShellRequest; try { - bootstrap = new Bootstrap(args); + Bootstrap bootstrap = new Bootstrap(args); exitShellRequest = bootstrap.run(); } catch (RuntimeException t) { @@ -144,7 +139,7 @@ public class Bootstrap { } public ExitShellRequest run() { - + StopWatch sw = new StopWatch("Spring Shell"); String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute(); // The shell is used JLineShellComponent shell = ctx.getBean("shell", JLineShellComponent.class); @@ -187,4 +182,4 @@ public class Bootstrap { public JLineShellComponent getJLineShellComponent() { return ctx.getBean("shell", JLineShellComponent.class); } -} \ No newline at end of file +}