When does Spring Batch call a skip listener method? Just after the item reader, processor, or writer
throws the to-be-skipped exception you may think. No, not just after. Spring Batch postpones the call to
skip listeners to right before committing the transaction for the chunk. Why is that? Because something
wrong can happen after Spring Batch skips an item and Spring Batch could then rollback the transaction.
Imagine that the item reader throws a to-be-skipped exception. Later on, something goes wrong during
the writing phase of the same chunk and Spring Batch rolls back the transaction, and could even fail the
job execution. You wouldn’t want to log the skipped item during the reading phase, because Spring Batch
rolled back the whole chunk! That’s why Spring Batch calls skip listeners just before the commit of the
chunk, when it’s almost certain nothing unexpected could happen.