From c8d9bd4f21cefac4dbeb33648871babf585d3f54 Mon Sep 17 00:00:00 2001 From: eugenp Date: Mon, 28 Dec 2015 18:23:13 +0200 Subject: [PATCH] spring batch work --- .../.classpath | 6 +++++- {spring-batch-intro => spring-batch}/.project | 8 +++++++- {spring-batch-intro => spring-batch}/pom.xml | 7 +++---- .../org/baeldung/spring_batch_intro/App.java | 18 +++++++----------- .../spring_batch_intro/SpringBatchConfig.java | 0 .../spring_batch_intro/SpringConfig.java | 0 .../spring_batch_intro/model/Transaction.java | 0 .../service/CustomItemProcessor.java | 0 .../service/RecordFieldSetMapper.java | 0 .../src/main/resources/input/record.csv | 0 .../src/main/resources/spring-batch-intro.xml | 0 .../src/main/resources/spring.xml | 0 .../xml/output.xml | 0 13 files changed, 22 insertions(+), 17 deletions(-) rename {spring-batch-intro => spring-batch}/.classpath (83%) rename {spring-batch-intro => spring-batch}/.project (69%) rename {spring-batch-intro => spring-batch}/pom.xml (85%) rename {spring-batch-intro => spring-batch}/src/main/java/org/baeldung/spring_batch_intro/App.java (60%) rename {spring-batch-intro => spring-batch}/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java (100%) rename {spring-batch-intro => spring-batch}/src/main/java/org/baeldung/spring_batch_intro/SpringConfig.java (100%) rename {spring-batch-intro => spring-batch}/src/main/java/org/baeldung/spring_batch_intro/model/Transaction.java (100%) rename {spring-batch-intro => spring-batch}/src/main/java/org/baeldung/spring_batch_intro/service/CustomItemProcessor.java (100%) rename {spring-batch-intro => spring-batch}/src/main/java/org/baeldung/spring_batch_intro/service/RecordFieldSetMapper.java (100%) rename {spring-batch-intro => spring-batch}/src/main/resources/input/record.csv (100%) rename {spring-batch-intro => spring-batch}/src/main/resources/spring-batch-intro.xml (100%) rename {spring-batch-intro => spring-batch}/src/main/resources/spring.xml (100%) rename {spring-batch-intro => spring-batch}/xml/output.xml (100%) diff --git a/spring-batch-intro/.classpath b/spring-batch/.classpath similarity index 83% rename from spring-batch-intro/.classpath rename to spring-batch/.classpath index 395dbde027..e7ac9faf11 100644 --- a/spring-batch-intro/.classpath +++ b/spring-batch/.classpath @@ -12,7 +12,11 @@ - + + + + + diff --git a/spring-batch-intro/.project b/spring-batch/.project similarity index 69% rename from spring-batch-intro/.project rename to spring-batch/.project index 032f8a9541..0159a7237c 100644 --- a/spring-batch-intro/.project +++ b/spring-batch/.project @@ -1,6 +1,6 @@ - spring-batch-intro + spring-batch @@ -15,8 +15,14 @@ + + org.springframework.ide.eclipse.core.springbuilder + + + + org.springframework.ide.eclipse.core.springnature org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature diff --git a/spring-batch-intro/pom.xml b/spring-batch/pom.xml similarity index 85% rename from spring-batch-intro/pom.xml rename to spring-batch/pom.xml index 28d48c594e..c85aeff6f3 100644 --- a/spring-batch-intro/pom.xml +++ b/spring-batch/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.baeldung - spring-batch-intro + spring-batch 0.1-SNAPSHOT jar - spring-batch-intro + spring-batch http://maven.apache.org diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/App.java similarity index 60% rename from spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java rename to spring-batch/src/main/java/org/baeldung/spring_batch_intro/App.java index d6af37595c..2ce4dae6e6 100644 --- a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java +++ b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/App.java @@ -4,31 +4,27 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - public class App { - public static void main(String[] args) { + public static void main(final String[] args) { // Spring Java config - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(SpringConfig.class); context.register(SpringBatchConfig.class); context.refresh(); // Spring xml config - // ApplicationContext context = new ClassPathXmlApplicationContext( - // "spring-batch-intro.xml"); + // ApplicationContext context = new ClassPathXmlApplicationContext("spring-batch.xml"); - JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); - Job job = (Job) context.getBean("firstBatchJob"); + final JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); + final Job job = (Job) context.getBean("firstBatchJob"); System.out.println("Starting the batch job"); try { - JobExecution execution = jobLauncher.run(job, new JobParameters()); + final JobExecution execution = jobLauncher.run(job, new JobParameters()); System.out.println("Job Status : " + execution.getStatus()); System.out.println("Job succeeded"); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); System.out.println("Job failed"); } diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java similarity index 100% rename from spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java rename to spring-batch/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/SpringConfig.java b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/SpringConfig.java similarity index 100% rename from spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/SpringConfig.java rename to spring-batch/src/main/java/org/baeldung/spring_batch_intro/SpringConfig.java diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/model/Transaction.java b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/model/Transaction.java similarity index 100% rename from spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/model/Transaction.java rename to spring-batch/src/main/java/org/baeldung/spring_batch_intro/model/Transaction.java diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/service/CustomItemProcessor.java b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/service/CustomItemProcessor.java similarity index 100% rename from spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/service/CustomItemProcessor.java rename to spring-batch/src/main/java/org/baeldung/spring_batch_intro/service/CustomItemProcessor.java diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/service/RecordFieldSetMapper.java b/spring-batch/src/main/java/org/baeldung/spring_batch_intro/service/RecordFieldSetMapper.java similarity index 100% rename from spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/service/RecordFieldSetMapper.java rename to spring-batch/src/main/java/org/baeldung/spring_batch_intro/service/RecordFieldSetMapper.java diff --git a/spring-batch-intro/src/main/resources/input/record.csv b/spring-batch/src/main/resources/input/record.csv similarity index 100% rename from spring-batch-intro/src/main/resources/input/record.csv rename to spring-batch/src/main/resources/input/record.csv diff --git a/spring-batch-intro/src/main/resources/spring-batch-intro.xml b/spring-batch/src/main/resources/spring-batch-intro.xml similarity index 100% rename from spring-batch-intro/src/main/resources/spring-batch-intro.xml rename to spring-batch/src/main/resources/spring-batch-intro.xml diff --git a/spring-batch-intro/src/main/resources/spring.xml b/spring-batch/src/main/resources/spring.xml similarity index 100% rename from spring-batch-intro/src/main/resources/spring.xml rename to spring-batch/src/main/resources/spring.xml diff --git a/spring-batch-intro/xml/output.xml b/spring-batch/xml/output.xml similarity index 100% rename from spring-batch-intro/xml/output.xml rename to spring-batch/xml/output.xml