class JobStep extends AbstractStep {

	/**
	 * The key for the job parameters in the step execution context. Needed for restarts.
	 */
	private static final String JOB_PARAMETERS_KEY = JobStep.class.getName() + ".JOB_PARAMETERS";

	private Job job;

	private JobLauncher jobLauncher;

	private JobParametersExtractor jobParametersExtractor = new DefaultJobParametersExtractor();

	@Override
	public void afterPropertiesSet() throws Exception {
		super.afterPropertiesSet();
		Assert.state(jobLauncher != null, "A JobLauncher must be provided");
		Assert.state(job != null, "A Job must be provided");
	}

	/**
	 * The {@link Job} to delegate to in this step.
	 * @param job a {@link Job}
	 */
	public void setJob(Job job) {
		this.job = job;
	}

	/**
	 * A {@link JobLauncher} is required to be able to run the enclosed {@link Job}.
	 * @param jobLauncher the {@link JobLauncher} to set
	 */
	public void setJobLauncher(JobLauncher jobLauncher) {
		this.jobLauncher = jobLauncher;
	}

	/**
	 * The {@link JobParametersExtractor} is used to extract
	 * {@link JobParametersExtractor} from the {@link StepExecution} to run the
	 * {@link Job}. By default an instance will be provided that simply copies the
	 * {@link JobParameters} from the parent job.
	 * @param jobParametersExtractor the {@link JobParametersExtractor} to set
	 */
	public void setJobParametersExtractor(JobParametersExtractor jobParametersExtractor) {
		this.jobParametersExtractor = jobParametersExtractor;
	}

	/**
	 * Execute the job provided by delegating to the {@link JobLauncher} to prevent
	 * duplicate executions. The job parameters will be generated by the
	 * {@link JobParametersExtractor} provided (if any), otherwise empty. On a restart,
	 * the job parameters will be the same as the last (failed) execution.
	 *
	 * @see AbstractStep#doExecute(StepExecution)
	 */
	@Override
	protected void doExecute(StepExecution stepExecution) throws Exception {<FILL_FUNCTION_BODY>}

	/**
	 * Determines the {@link ExitStatus} taking into consideration the {@link ExitStatus}
	 * from the {@link StepExecution}, which invoked the {@link JobStep}, and the
	 * {@link JobExecution}.
	 * @param stepExecution the {@link StepExecution} which invoked the
	 * {@link JobExecution}
	 * @param jobExecution the {@link JobExecution}
	 * @return the final {@link ExitStatus}
	 */
	private ExitStatus determineStepExitStatus(StepExecution stepExecution, JobExecution jobExecution) {
		ExitStatus exitStatus = stepExecution.getExitStatus() != null ? stepExecution.getExitStatus()
				: ExitStatus.COMPLETED;

		return exitStatus.and(jobExecution.getExitStatus());
	}

}


		ExecutionContext executionContext = stepExecution.getExecutionContext();

		executionContext.put(STEP_TYPE_KEY, this.getClass().getName());

		JobParameters jobParameters;
		if (executionContext.containsKey(JOB_PARAMETERS_KEY)) {
			jobParameters = (JobParameters) executionContext.get(JOB_PARAMETERS_KEY);
		}
		else {
			jobParameters = jobParametersExtractor.getJobParameters(job, stepExecution);
			executionContext.put(JOB_PARAMETERS_KEY, jobParameters);
		}

		JobExecution jobExecution = jobLauncher.run(job, jobParameters);

		stepExecution.setExitStatus(determineStepExitStatus(stepExecution, jobExecution));

		if (jobExecution.getStatus().isUnsuccessful()) {
			// AbstractStep will take care of the step execution status
			throw new UnexpectedJobExecutionException("Step failure: the delegate Job failed in JobStep.");
		}
		else if (jobExecution.getStatus().equals(BatchStatus.STOPPED)) {
			stepExecution.setStatus(BatchStatus.STOPPED);
		}
	
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void afterPropertiesSet() throws java.lang.Exception,public final void execute(org.springframework.batch.core.StepExecution) throws org.springframework.batch.core.JobInterruptedException, org.springframework.batch.core.UnexpectedJobExecutionException,public java.lang.String getName() ,public int getStartLimit() ,public boolean isAllowStartIfComplete() ,public void registerStepExecutionListener(org.springframework.batch.core.StepExecutionListener) ,public void setAllowStartIfComplete(boolean) ,public void setBeanName(java.lang.String) ,public void setJobRepository(org.springframework.batch.core.repository.JobRepository) ,public void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry) ,public void setName(java.lang.String) ,public void setObservationConvention(org.springframework.batch.core.observability.BatchStepObservationConvention) ,public void setObservationRegistry(io.micrometer.observation.ObservationRegistry) ,public void setStartLimit(int) ,public void setStepExecutionListeners(org.springframework.batch.core.StepExecutionListener[]) ,public java.lang.String toString() <variables>private boolean allowStartIfComplete,private org.springframework.batch.core.repository.JobRepository jobRepository,private static final org.apache.commons.logging.Log logger,private io.micrometer.core.instrument.MeterRegistry meterRegistry,private java.lang.String name,private org.springframework.batch.core.observability.BatchStepObservationConvention observationConvention,private io.micrometer.observation.ObservationRegistry observationRegistry,private int startLimit,private final org.springframework.batch.core.listener.CompositeStepExecutionListener stepExecutionListener