From c22bad1e6a6dcb5a419f1685cd7c3c429bb7a3ac Mon Sep 17 00:00:00 2001 From: mpollack Date: Thu, 20 Dec 2012 05:49:37 +0800 Subject: [PATCH] Change how JLineShellComponent is access in Bootstrap class --- src/main/java/org/springframework/shell/Bootstrap.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/springframework/shell/Bootstrap.java b/src/main/java/org/springframework/shell/Bootstrap.java index 69310cc9..841e61e3 100644 --- a/src/main/java/org/springframework/shell/Bootstrap.java +++ b/src/main/java/org/springframework/shell/Bootstrap.java @@ -39,7 +39,6 @@ import org.springframework.util.StopWatch; public class Bootstrap { private static Bootstrap bootstrap; - private JLineShellComponent shell; private AnnotationConfigApplicationContext parentApplicationContext; private static StopWatch sw = new StopWatch("Spring Shell"); private static CommandLine commandLine; @@ -49,7 +48,7 @@ public class Bootstrap { sw.start(); ExitShellRequest exitShellRequest; try { - bootstrap = new Bootstrap(args); + bootstrap = new Bootstrap(args); exitShellRequest = bootstrap.run(); } catch (RuntimeException t) { throw t; @@ -152,6 +151,8 @@ public class Bootstrap { protected ExitShellRequest run() { String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute(); + // The shell is used + JLineShellComponent shell = parentApplicationContext.getBean("shell", JLineShellComponent.class); ExitShellRequest exitShellRequest; if (null != commandsToExecuteAndThenQuit) { @@ -189,6 +190,6 @@ public class Bootstrap { } JLineShellComponent getJLineShellComponent() { - return shell; + return parentApplicationContext.getBean("shell", JLineShellComponent.class); } } \ No newline at end of file