可以使用JobExecutionDecider
流到你的代码来纠正一步。
你有一个抽象的步骤(BaseStep
)当读写器的定义,而不是处理器和定义,你必然正确的处理器
<batch:step id="StepTestFile1" parent="BaseStep">
<batch:processor ref="path.to.TestFileProcessor1" />
</batch:step>
等3具体步骤。
在你JobExecutionDecider
你可以去正确的步骤基于文件名(伪代码):
class MyDecider implements JobExecutionDecider {
public FlowExecutionStatus decide(JobExecution jobExecution,StepExecution stepExecution) {
if(filename is testfile-1.txt) return new FlowExecutionStatus("StepTestFile1");
if(filename is testfile-2.txt) return new FlowExecutionStatus("StepTestFile2");
if(filename is testfile-3.txt) return new FlowExecutionStatus("StepTestFile3");
}
}