Class JobParameterExecutionContextCopyListener
- java.lang.Object
- org.springframework.batch.core.listener.StepExecutionListenerSupport
- org.springframework.batch.core.listener.JobParameterExecutionContextCopyListener
- All Implemented Interfaces:
StepExecutionListener
,StepListener
public class JobParameterExecutionContextCopyListener extends StepExecutionListenerSupport
This class can be used to automatically copy items from theJobParameters
to theStep
ExecutionContext
. A list of keys should be provided that correspond to the items in theStep
ExecutionContext
that should be copied.- Since:
- 2.0
- Author:
- Dave Syer
Constructor Summary
Constructors Constructor Description JobParameterExecutionContextCopyListener()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeStep(StepExecution stepExecution)
void
setKeys(java.lang.String[] keys)
Methods inherited from class org.springframework.batch.core.listener.StepExecutionListenerSupport
afterStep
Method Detail
setKeys
public void setKeys(java.lang.String[] keys)
- Parameters:
keys
- A list of keys corresponding to items in theJobParameters
that should be copied.
beforeStep
public void beforeStep(StepExecution stepExecution)
Copy attributes from theJobParameters
to theStep
ExecutionContext
, if not already present. The the key is already present we assume that a restart is in operation and the previous value is needed. If the provided keys are empty defaults to copy all keys in theJobParameters
.- Specified by:
beforeStep
in interfaceStepExecutionListener
- Overrides:
beforeStep
in classStepExecutionListenerSupport
- Parameters:
stepExecution
- instance ofStepExecution
.