sustain/src/main/java/net/happyonroad/component/container/AppLauncher.java
public static int mainWithExitCode(String[] args) throws Exception {
        LaunchEnvironment environment = detectEnvironment();

        Component mainComponent = null;
        try {
            logger.debug(banner("Resolving starts from {}", args[0]));
            mainComponent = environment.resolveComponent(args[0]);
            logger.debug(banner("Resolved  starts from {}", args[0]));

            AppLauncher launcher = environment.createLauncher(mainComponent);
            //去掉主入口参数之后，将其余参数传入
            String[] newArgs = new String[args.length - 1];
            System.arraycopy(args, 1, newArgs, 0, args.length - 1);
            //启动程序，根据剩余的 newArgs，可能有多种启动方式
            // 包括: 打印组件依赖列表
            //      启动系统(在当前进程内启动系统)
            //      停止系统(通过本机Socket停止另外一个已经在运行的系统)
            environment.execute(launcher, newArgs);
            return 0;
        } catch (ComponentException ex) {
            logger.error("{} : {}", ex.getPath(), describeException(ex));
            return -1;
        } catch (Throwable ex) {
            logger.error("Failed: {}", describeException(ex));
            return -1;
        } finally {
            if (mainComponent != null) {
                environment.unload(mainComponent);
            }
            environment.shutdown();
        }
    }
public static int mainWithExitCode(String[] args) throws Exception {
        LaunchEnvironment environment = detectEnvironment();

        Component mainComponent = null;
        try {
            logger.debug(banner("Resolving starts from {}", args[0]));
            mainComponent = environment.resolveComponent(args[0]);
            logger.debug(banner("Resolved  starts from {}", args[0]));

            AppLauncher launcher = environment.createLauncher(mainComponent);
            //去掉主入口参数之后，将其余参数传入
            String[] newArgs = new String[args.length - 1];
            System.arraycopy(args, 1, newArgs, 0, args.length - 1);
            //启动程序，根据剩余的 newArgs，可能有多种启动方式
            // 包括: 打印组件依赖列表
            //      启动系统(在当前进程内启动系统)
            //      停止系统(通过本机Socket停止另外一个已经在运行的系统)
            environment.execute(launcher, newArgs);
            return 0;
        } catch (ComponentException ex) {
            logger.error("{} : {}", ex.getPath(), describeException(ex));
            return -1;
        } catch (Throwable ex) {
            logger.error("Failed: {}", describeException(ex));
            return -1;
        } finally {
            if (mainComponent != null) {
                environment.unload(mainComponent);
            }
            environment.shutdown();
        }
    }
启动逻辑，暂时还没有支持停止

@param args The application command-line arguments.
@return an integer exit code
@throws Exception If an error occurs.