BAEL-3093: Configuring Skip Logic in Spring Batch (#7946)

This commit is contained in:
kwoyke
2019-10-07 05:45:19 +02:00
committed by Grzegorz Piwowarek
parent 1d0596f23c
commit c2b029fd85
7 changed files with 158 additions and 15 deletions

View File

@@ -18,9 +18,17 @@ public class App {
// Spring xml config
// ApplicationContext context = new ClassPathXmlApplicationContext("spring-batch.xml");
runJob(context, "firstBatchJob");
runJob(context, "skippingBatchJob");
runJob(context, "skipPolicyBatchJob");
}
private static void runJob(AnnotationConfigApplicationContext context, String batchJobName) {
final JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
final Job job = (Job) context.getBean("firstBatchJob");
System.out.println("Starting the batch job");
final Job job = (Job) context.getBean(batchJobName);
System.out.println("----------------------------------------");
System.out.println("Starting the batch job: " + batchJobName);
try {
// To enable multiple execution of a job with the same parameters
JobParameters jobParameters = new JobParametersBuilder()