Chapter 8. Running Batch Jobs

In this chapter, we will cover the following recipes:

  • Installing and configuring Spring Batch
  • Creating a job
  • Executing a job from the command line
  • Executing a job from a controller method
  • Using job parameters
  • Executing a system command
  • Scheduling a job
  • Creating a read/process/write step
  • Reading an XML file
  • Generating a CSV file
  • Reading from a database
  • Unit testing batch jobs

Introduction

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 ...

Get Spring Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.