public static List<JobExecution> startJobs(ListableBeanFactory bf) {
return startJobs(bf, new JobParameters());
}
public static List<JobExecution> startJobs(ListableBeanFactory bf, JobParameters params) {
JobLauncher launcher = bf.getBean(JobLauncher.class);
Map<String, Job> jobs = bf.getBeansOfType(Job.class);
List<JobExecution> executions = new ArrayList<JobExecution>(jobs.size());
for (Map.Entry<String, Job> entry : jobs.entrySet()) {
RuntimeException e = null;
try {
JobExecution jobExec = launcher.run(entry.getValue(), params);
executions.add(jobExec);
if (jobExec.getStatus().equals(BatchStatus.FAILED)) {
e = new BeanInitializationException("Failed executing job " + entry.getKey());
}
} catch (Exception ex) {