配置多个作业时,Spring批处理JobStep失败

时间:2015-11-28 15:51:28

标签: java spring parallel-processing spring-batch

我正在尝试在单个上下文文件中配置多个作业并将它们并行运行.Below是配置

    <batch:job id="ParallelJob" incrementer="runIdIncrementer" restartable="true">
            <batch:split id="parallelprocessing" task-executor="taskExecutor">
                <batch:flow>
                    <batch:step id="ParallelJob.step1" >
                            <batch:job ref="JobA" job-launcher="jobLauncher" job-parameters-extractor="jobParametersExtractor"/>
                    </batch:step>       
                </batch:flow>
                <batch:flow>
                    <batch:step id="ParallelJob.step2" >
                            <batch:job ref="JobB" job-launcher="jobLauncher" job-parameters-extractor="jobParametersExtractor"/>
                    </batch:step>       
                </batch:flow>
            </batch:split>
        </batch:job> 


<batch:job id="JobA" restartable="true">
        <batch:step id="abc">
            <batch:tasklet >
                <batch:chunk reader="reader" writer="writer" processor="processor"  />
            </batch:tasklet>
      </batch:step>

    </batch:job>

<batch:job id="JobB" restartable="true">
        <batch:step id="abc">
            <batch:tasklet >
                <batch:chunk reader="reader" writer="writer" processor="processor"  />
            </batch:tasklet>
      </batch:step>

    </batch:job>

我正面临异常org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.batch.core.Job] is defined: expected single matching bean but found 3:ParallelJob,JobA,JobB。有人可以帮助我。参考http://docs.spring.io/spring-batch/reference/html/configureStep.html#split-flows

1 个答案:

答案 0 :(得分:0)

我能够解决这个问题。我正在其中一个我不再使用的课程中注册工作