Java Reference
In-Depth Information
C H A P T E R 2
Spring Batch 101
The Java world is full of open source frameworks. Each has its own learning curve, but when you pick up
most new frameworks, you at least understand the domain. For example, when you learned Struts or
Spring MVC, you had probably developed a web-based application before. With that previous
experience, converting your custom request-handling to the way a given framework handles it is really
just a matter of learning a new syntax.
However, learning a framework where the domain is completely new is a bit harder. You run across
jargon like job , step , and item processor as if it made sense in the context you're coming from. The fact is,
it probably doesn't. So, I chose this chapter to serve as batch processing 101. The chapter covers the
following topics:
The architecture of batch: This section begins to dig a bit deeper into what makes
up a batch process and defines terms that you'll see throughout the rest of the
book.
Project setup: I learn by doing. This topic is assembled in a way that shows you
examples of how the Spring Batch framework functions, explains why it works the
way it does, and gives you the opportunity to code along. This section covers the
basic setup for a Maven-based Spring Batch project.
Hello, World! The first law of thermodynamics talks about conserving energy. The
first law of motion deals with how objects at rest tend to stay at rest unless acted
upon by an outside force. Unfortunately, the first law of computer science seems
to be that whatever new technology you learn, you must write a “Hello, World!”
program using said technology. Here you obey the law.
Running a job: How to execute your first job may not be immediately apparent, so
I'll walk you through how jobs are executed as well as how to pass in basic
parameters.
The job results: You finish by seeing how jobs complete. This section covers what
the statuses are and how they impact what Spring Batch does.
With all of that in mind, what is a job, anyway?
The Architecture of Batch
The last chapter spent some time talking about the three layers of the Spring Batch framework: the
application layer, the core layer, and the infrastructure layer. The application layer represents the code
you develop, which for the most part interfaces with the core layer. The core layer consists of the actual
 
 
Search WWH ::




Custom Search