Spring Batch Simple Example Part 3

In this post I will explain how to combine the reader and writer in a job and how to run the job. We define a job which will transfer the employee records from one file to another file in batches. <batch:job id=”importEmployees”> <batch:step id=”readWriteEmployees”> <batch:tasklet> <batch:chunk reader=”reader” writer=”writer” commit-interval=”50″/> </batch:tasklet> </batch:step> </batch:job> <bean id=”transactionManager” class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”>…… Continue reading Spring Batch Simple Example Part 3

Spring Batch Simple Example Part 2

In this post, I will explain how to write the employee objects created in the reading process to a file. To write the list of employee records in batches, we need to create an instance of org.springframework.batch.item.file.FlatFileItemWriter. It takes two information1) the resource file where the information has to be written2) An instance of LineAggregator…… Continue reading Spring Batch Simple Example Part 2