From the course: Spring: Spring Batch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Listeners

Listeners

From the course: Spring: Spring Batch

Start my 1-month free trial

Listeners

- [Instructor] At some point in a batch job, you may need to take control of batch processing and introduce your own logic. That's where listeners come into play. Listeners provide hooks into the flow of a job at various points that allow you to introduce additional batch processing logic for complex use cases. There are many listener interfaces within the framework at the job, step, chunk, and item levels of the domain. Listener implementations are created by implementing an interface, or adding annotations to a POJO, then registering the listener at the appropriate configuration level. Registered listeners are notified by the framework at key points. For example, AfterStep completion. Once notified, job processing logic found in the listener is invoked to perform its particular logic at the appropriate point in the batch execution flow. So let's say you need to introduce some header information to a file created…

Contents