public JobExecution runFlow(Flow flow,int batchSize,int threadCount,JobStatusListener statusListener){
  JobExecution result=null;
  try {
    ConfigurableApplicationContext ctx=buildApplicationContext(flow,statusListener);
    JobParameters params=buildJobParameters(flow,batchSize,threadCount);
    JobLauncher launcher=ctx.getBean(JobLauncher.class);
    Job job=ctx.getBean(Job.class);
    result=launcher.run(job,params);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return result;
}

public JobExecution runFlow ( Flow flow , int batchSize , int threadCount , JobStatusListener statusListener ) { JobExecution result = null ; try { ConfigurableApplicationContext ctx = buildApplicationContext ( flow , statusListener ) ; JobParameters params = buildJobParameters ( flow , batchSize , threadCount ) ; JobLauncher launcher = ctx . getBean ( JobLauncher . class ) ; Job job = ctx . getBean ( Job . class ) ; result = launcher . run ( job , params ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return result ; }
runs a given flow
