In Spring Batch, a Job is the complete batch process, and a Step is one independent, sequential phase of that job. A job is a container for an ordered flow of steps; each step does the real work, either by reading, processing and writing items in chunks or by running a single task.
Understanding this split is the foundation of the framework: the job defines what runs and in what order, while each step defines how a piece of data is processed and how its progress is tracked and restarted.
org.springframework.batch.core.Job represents one batch process, such as "import customers" or "generate monthly invoices". It has a unique name, executes its steps in a defined flow and can be restarted if it fails.
A Job is a definition, not a run. Each time it is launched with a set of JobParameters, Spring Batch creates a JobInstance (the logical run) and a JobExecution (one attempt). The job also supports:
JobParametersIncrementer to generate new parameters per run.JobParametersValidator to reject bad input.JobExecutionListener callbacks before and after the run.org.springframework.batch.core.Step is one phase of a job. Each step has its own StepExecution that records read, write, skip and commit counts plus its status, so a restarted job can resume at the failed step rather than from the beginning.
There are two main kinds of step:
| Step type | Use it when | Core pieces |
|---|---|---|
| Chunk-oriented | Processing many records | ItemReader, ItemProcessor, ItemWriter |
| Tasklet | One action such as cleanup or a file move | Tasklet |
Spring Batch 5 and later (Spring Boot 3) removed JobBuilderFactory and StepBuilderFactory. You create builders directly and pass in the JobRepository and a PlatformTransactionManager. With Spring Boot, @EnableBatchProcessing is not required, because auto-configuration supplies the infrastructure beans.
The importStep reads items, processes them and writes them in transactions of 100. If an item throws IllegalArgumentException, up to 10 such items are skipped instead of failing the job. cleanupStep runs one task after the import succeeds.
Steps do not have to run in a straight line. You can branch on the exit status of a step.
Parallel flows use split with a TaskExecutor, and a step can itself launch a sub-job through a JobStep.
Every execution is stored by the JobRepository:
JobInstance: a job plus a unique set of identifying parameters.JobExecution: one attempt to run that instance, with status and timestamps.StepExecution: one attempt of one step, with read, write, skip and rollback counters.ExecutionContext: key-value state saved per job or step, which enables restart.Because a completed step is recorded, a restarted job skips it by default, which is why step logic should be idempotent or written to resume safely.
A job is the whole batch process made of one or more steps. A step is one phase that has its own reader, processor and writer or a single tasklet, and its own execution state.
Use a tasklet for a single action such as deleting files or calling a stored procedure. Use a chunk step when you process many items and need commit intervals, skip and retry.
Yes. A job needs at least one step, and a single-step job is common.
Spring Batch 5 moved to explicit builders and explicit JobRepository and transaction manager arguments, which makes the dependencies visible and removes hidden configuration.
A Job orchestrates the flow, and a Step does one unit of work with its own tracked state. Build jobs with JobBuilder, use chunk steps for volume and tasklets for single actions, and rely on the JobRepository metadata to restart failed runs from the right step.