From 17d5f4a920cb62fb895cce7f0c525bdacdac36df Mon Sep 17 00:00:00 2001 From: Devendra Desale Date: Wed, 23 Dec 2015 14:17:31 +0530 Subject: [PATCH] updated header to csv --- .../org/baeldung/spring_batch_intro/App.java | 2 +- .../spring_batch_intro/SpringBatchConfig.java | 1 + .../src/main/resources/input/record.csv | 1 + .../src/main/resources/spring-batch-intro.xml | 31 +++++++------------ spring-batch-intro/xml/output.xml | 2 +- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java b/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java index db963fff20..d6af37595c 100644 --- a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java +++ b/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/App.java @@ -27,7 +27,7 @@ public class App { try { JobExecution execution = jobLauncher.run(job, new JobParameters()); System.out.println("Job Status : " + execution.getStatus()); - System.out.println("Job completed"); + System.out.println("Job succeeded"); } catch (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-intro/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java index f0e3b364b6..a024cbc04e 100644 --- a/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java +++ b/spring-batch-intro/src/main/java/org/baeldung/spring_batch_intro/SpringBatchConfig.java @@ -50,6 +50,7 @@ public class SpringBatchConfig { DefaultLineMapper lineMapper = new DefaultLineMapper(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(new RecordFieldSetMapper()); + reader.setLinesToSkip(1); reader.setLineMapper(lineMapper); return reader; } diff --git a/spring-batch-intro/src/main/resources/input/record.csv b/spring-batch-intro/src/main/resources/input/record.csv index 3a1437eed5..e554becb2a 100644 --- a/spring-batch-intro/src/main/resources/input/record.csv +++ b/spring-batch-intro/src/main/resources/input/record.csv @@ -1,3 +1,4 @@ +username, user_id, transaction_date, transaction_amount devendra, 1234, 31/10/2015, 10000 john, 2134, 3/12/2015, 12321 robin, 2134, 2/02/2015, 23411 \ No newline at end of file diff --git a/spring-batch-intro/src/main/resources/spring-batch-intro.xml b/spring-batch-intro/src/main/resources/spring-batch-intro.xml index 3b1f11521f..93606d232f 100644 --- a/spring-batch-intro/src/main/resources/spring-batch-intro.xml +++ b/spring-batch-intro/src/main/resources/spring-batch-intro.xml @@ -1,18 +1,15 @@ - + http://www.springframework.org/schema/batch/spring-batch-3.0.xsd + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-4.2.xsd +"> - - + - @@ -20,23 +17,21 @@ + value="username,userid,transaction_date,transaction_amount" /> - + - + - + @@ -45,13 +40,11 @@ - org.baeldung.spring_batch_intro.model.Transaction - + org.baeldung.spring_batch_intro.model.Transaction - diff --git a/spring-batch-intro/xml/output.xml b/spring-batch-intro/xml/output.xml index 9e57fa38f2..acf4969341 100644 --- a/spring-batch-intro/xml/output.xml +++ b/spring-batch-intro/xml/output.xml @@ -1 +1 @@ -10000.02015-10-31T00:00:00+08:001234devendra12321.02015-12-03T00:00:00+08:002134john23411.02015-02-02T00:00:00+08:002134robin \ No newline at end of file +10000.02015-10-31T00:00:00+05:301234devendra12321.02015-12-03T00:00:00+05:302134john23411.02015-02-02T00:00:00+05:302134robin \ No newline at end of file