Chaining multiple JobParametersValidator implementations

In this post under Spring Batch, I will show how to chain multiple JobParametersValidator interface implementations. For our example I will create two JobParametersValidator interface implementations as shown below Validator1 package package23; import java.util.Map; import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersInvalidException; import org.springframework.batch.core.JobParametersValidator; public class Validator1 implements JobParametersValidator { @Override public void validate(JobParameters jobParameters) throws JobParametersInvalidException…… Continue reading Chaining multiple JobParametersValidator implementations

Validating Items using ValidatingItemProcessor

In this post under Spring Batch, I will introduce ValidatingItemProcessor and explain how to use it with an example. ValidatingItemProcessor is a implementation of org.springframework.batch.item.ItemProcessor interface. As mentioned in my previous posts, implementation of ItemProcessor is used to place business logic. The implementation of ItemProcessor which contains the business logic is placed between the reader…… Continue reading Validating Items using ValidatingItemProcessor

SuffixRecordSeparatorPolicy example

In this post under Spring Batch, I will explain the purpose and how to use SuffixRecordSeparatorPolicy class with an example. SuffixRecordSeparatorPolicy class is a concrete implementation of org.springframework.batch.item.file.separator.RecordSeparatorPolicy interface. In one of my previous post I have explained the purpose of RecordSeparatorPolicy and how to use it. For recap, RecordSeparatorPolicy interface is used to tell…… Continue reading SuffixRecordSeparatorPolicy example

JsonRecordSeparatorPolicy example

In this post under Spring Batch, I will explain the purpose and how to use JsonRecordSeparatorPolicy class with an example. JsonRecordSeparatorPolicy class is a concrete implementation of org.springframework.batch.item.file.separator.RecordSeparatorPolicy interface. In one of my previous post I have explained the purpose of RecordSeparatorPolicy and how to use it. For recap, RecordSeparatorPolicy interface is used to tell…… Continue reading JsonRecordSeparatorPolicy example

JsonLineMapper Example

In this post under Spring Batch, I will explain the purpose of JsonLineMapper with an example. JsonLineMapper is used with reader bean for reading file containing JSON input as shown below JsonFileInput.txt {“id”:”id0″,”name”:”name0″,”status”:”status0″,”salary”:0} {“id”:”id1″,”name”:”name1″,”status”:”status1″,”salary”:1} {“id”:”id2″,”name”:”name2″,”status”:”status2″,”salary”:2} {“id”:”id3″,”name”:”name3″,”status”:”status3″,”salary”:3} {“id”:”id4″,”name”:”name4″,”status”:”status4″,”salary”:4} {“id”:”id5″,”name”:”name5″,”status”:”status5″,”salary”:5} {“id”:”id6″,”name”:”name6″,”status”:”status6″,”salary”:6} {“id”:”id7″,”name”:”name7″,”status”:”status7″,”salary”:7} {“id”:”id8″,”name”:”name8″,”status”:”status8″,”salary”:8} {“id”:”id9″,”name”:”name9″,”status”:”status9″,”salary”:9} Each line in the file is interpreted as a JSON object by JsonLineMapper.…… Continue reading JsonLineMapper Example