public class JobStep extends AbstractStep
Step that delegates to a Job to do its work. This is a
great tool for managing dependencies between jobs, and also to modularise
complex step logic into something that is testable in isolation. The job is
executed with parameters that can be extracted from the step execution, hence
this step can also be usefully used as the worker in a parallel or
partitioned execution.STEP_TYPE_KEY| Constructor and Description |
|---|
JobStep() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected void |
doExecute(StepExecution stepExecution)
Execute the job provided by delegating to the
JobLauncher to
prevent duplicate executions. |
void |
setJob(Job job)
The
Job to delegate to in this step. |
void |
setJobLauncher(JobLauncher jobLauncher)
A
JobLauncher is required to be able to run the enclosed
Job. |
void |
setJobParametersExtractor(JobParametersExtractor jobParametersExtractor)
The
JobParametersExtractor is used to extract
JobParametersExtractor from the StepExecution to run the
Job. |
close, doExecutionRegistration, doExecutionRelease, execute, getCompositeListener, getJobRepository, getName, getStartLimit, isAllowStartIfComplete, open, registerStepExecutionListener, setAllowStartIfComplete, setBeanName, setJobRepository, setName, setStartLimit, setStepExecutionListeners, toStringpublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class AbstractStepjava.lang.Exceptionpublic void setJobLauncher(JobLauncher jobLauncher)
JobLauncher is required to be able to run the enclosed
Job.jobLauncher - the JobLauncher to setpublic void setJobParametersExtractor(JobParametersExtractor jobParametersExtractor)
JobParametersExtractor is used to extract
JobParametersExtractor from the StepExecution to run the
Job. By default an instance will be provided that simply copies
the JobParameters from the parent job.jobParametersExtractor - the JobParametersExtractor to setprotected void doExecute(StepExecution stepExecution) throws java.lang.Exception
JobLauncher to
prevent duplicate executions. The job parameters will be generated by the
JobParametersExtractor provided (if any), otherwise empty. On a
restart, the job parameters will be the same as the last (failed)
execution.doExecute in class AbstractStepstepExecution - the current step contextjava.lang.ExceptionAbstractStep.doExecute(StepExecution)