Book Image


Book Image


Overview of this book

Table of Contents (19 chapters)
Spring Cookbook
About the Author
About the Reviewers


A batch job is a task executed outside the normal web application workflow (receiving an HTTP request and sending back an HTTP response). It can be executed by the web server as a separate process. It can also be launched directly from the command line.

Typically, a batch job either:

  • Imports or exports data at a scheduled time. For example, importing a CSV file in the database every night.

  • Executes some code asynchronously to avoid long page loads. For example, processing a video uploaded by the user or generating a big file that will be downloaded by the user.

Spring Batch provides a structure to define, run, and monitor batch jobs. A Job is defined as a sequence of steps:

A Job Instance is the combination of a job and some parameters. For example, the day's date and the name of the file to process. A Job Execution is created for a job instance. If the job execution fails, another job execution can be created for the same job instance.

A Job Execution generates a Step Execution...