Spring Batch - Application


Advertisements

Almost all the examples in this tutorial contain the following files −

  • Configuration file (XML file)
  • Tasklet/processor (Java class)
  • Java class with setters and getters (Java class (bean))
  • Mapper class (Java class)
  • Launcher class (Java class)

Configuration File

The configuration file (XML) contains the following −

  • The job and step definitions.

  • Beans defining readers and writers.

  • Definition of components like JobLauncher, JobRepository, Transaction Manager, and Data Source.

In our examples, for better understanding, we have divided this in to two files the job.xml file (defines job, step, reader and writer) and context.xml file (job launcher, job repository, transaction manager and data source).

Mapper Class

The Mapper class, depending upon the reader, implements interfaces such as row mapper, field set mapper, etc. It contains the code to get the data from the reader and to set it to a Java class with setter and getter methods (Java Bean).

Java Bean Class

A Java class with setters and getters (Java bean) represents data with multiple values. It acts as a helper class. We will pass the data from one component (reader, writer, processer) to other in the form of object of this class.

Tasklet/processor

The Tasklet/processor class contains the processing code of the Spring Batch application. A processor is a class which accepts an object that contains the data read, processes it, and returns the processed data (in the form object).

Launcher class

This class (App.java) contains the code to launch the Spring Batch application.

Application
Advertisements