To do this, you should be filtering in your ItemProcessor
, not the LineAggregator
. Your ItemProcessor
should return null, which won't be written out. Filtering with the LineAggregator
is too late in the process.
You can read more about filtering records using an ItemProcessor
in the documentation (section 6.3.2) here: http://docs.spring.io/spring-batch/reference/html/readersAndWriters.html