@Override
 public void configure(YarnClientBuilder builder) throws Exception {
   LaunchCommandsFactoryBean fb = new LaunchCommandsFactoryBean();
   fb.setRunner(CommandLineAppmasterRunner.class);
   fb.setContextFile(determineContextConfig());
   fb.setBeanName(beanName);
   fb.setStdout(stdout);
   fb.setStderr(stderr);
   fb.setArguments(arguments);
   fb.afterPropertiesSet();
   builder.setCommands(fb.getObject());
 }
  private static String[] createContainerCommands(SpringYarnAppmasterLaunchContextProperties syalcp)
      throws Exception {
    LaunchCommandsFactoryBean factory = new LaunchCommandsFactoryBean();
    String containerJar = syalcp.getArchiveFile();

    if (StringUtils.hasText(containerJar) && containerJar.endsWith("jar")) {
      factory.setJarFile(containerJar);
    } else if (StringUtils.hasText(syalcp.getRunnerClass())) {
      factory.setRunnerClass(syalcp.getRunnerClass());
    } else if (StringUtils.hasText(containerJar) && containerJar.endsWith("zip")) {
      factory.setRunnerClass("org.springframework.boot.loader.PropertiesLauncher");
    }

    factory.setArgumentsList(syalcp.getArgumentsList());

    if (syalcp.getArguments() != null) {
      Properties arguments = new Properties();
      arguments.putAll(syalcp.getArguments());
      factory.setArguments(arguments);
    }

    factory.setOptions(syalcp.getOptions());

    factory.setStdout("<LOG_DIR>/Container.stdout");
    factory.setStderr("<LOG_DIR>/Container.stderr");
    factory.afterPropertiesSet();
    return factory.getObject();
  }