From the course: Spring: Spring Batch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Restarting jobs

Restarting jobs

From the course: Spring: Spring Batch

Start my 1-month free trial

Restarting jobs

- [Narrator] Unfortunately, not every batch job runs successfully the first time. To help us handle this situation, Spring Batch allows failed jobs to be restarted. The framework only allows a job to be restarted if the overall status of a job execution is marked as failed or stopped. By default, it does not allow completed jobs to be restarted. When a job is restarted, Spring Batch will create a new job execution for the particular job instance that failed, and it will restart at the failed step, executing from that point forward. Let's see this in action by modifying a step within our job configuration to fail. That way we can see the results. So we're going to introduce some boolean logic within our drive to address step. Let's imagine that we can get lost while we are driving our package to the address for delivery. So, we'll just introduce a boolean, and we'll name that boolean Got Lost. And I'm going to…

Contents