Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Reusability is the Holy Grail of software engineering. Spring Batch is part of this quest when it comes to reusing batch components and job configurations. Indeed, portions of a job configuration can be generic and reused across jobs. In the advanced version of our import products job, before reading and writing products from a flat file, preliminary steps prepare the ground for the import: a first step downloads the ZIP archive, a second step decompresses the archive, and a third step checks the integrity of the decompressed files. These preliminary steps are generic and could be useful to other jobs: it’s common for a batch job to import data from a file it has downloaded. Why not externalize this flow and reuse it in other jobs? Figure 10.14 illustrates the process of reusing a flow in multiple jobs.