Spring 弹簧圈

Spring 弹簧圈,spring,spring-batch,Spring,Spring Batch,第一步,我在Spring Batch中有一个简单的配置: <batch:job id="collaborationJob" > <batch:step id="collaborationJobStep1"> <batch:tasklet> <batch:chunk reader="collaborationAlertReader" processor="WriteCollaborationPruningPr

第一步,我在Spring Batch中有一个简单的配置:

<batch:job id="collaborationJob" >
    <batch:step id="collaborationJobStep1">
        <batch:tasklet>
            <batch:chunk reader="collaborationAlertReader" processor="WriteCollaborationPruningProcessor" writer="alertCollaborationPruningWriter"
                commit-interval="10">
            </batch:chunk>
        </batch:tasklet>
        <batch:next on="*" to="collaborationJobStep2" />
        <batch:next on="FAILED" to="collaborationJobStep4"/>
    </batch:step>

如果在itemReader中读取的行数<10,则一切正常,但如果行数>=10,则在重复循环中输入:

2015-09-29 17:02:40,782 DEBUG [org.springframework.batch.core.step.tasklet.TaskletStep] - <Saving step execution before commit: StepExecution: id=1332, version=878, name=collaborationJobStep1, status=STARTED, exitStatus=EXECUTING, readCount=8780, filterCount=0, writeCount=8780 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=878, rollbackCount=0, exitDescription=>

2015-09-29 17:02:40,786 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=879>

2015-09-29 17:02:40,786 DEBUG [org.springframework.batch.core.scope.context.StepContextRepeatCallback] - <Preparing chunk execution for StepContext: org.springframework.batch.core.scope.context.StepContext@664020c7>

2015-09-29 17:02:40,786 DEBUG [org.springframework.batch.core.scope.context.StepContextRepeatCallback] - <Chunk execution starting: queue size=0>

2015-09-29 17:02:40,787 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Starting repeat context.>

2015-09-29 17:02:40,787 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=1>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=2>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=3>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=4>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=5>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=6>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=7>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=8>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=9>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat operation about to start at count=10>

2015-09-29 17:02:40,791 DEBUG [org.springframework.batch.repeat.support.RepeatTemplate] - <Repeat is complete according to policy and result value.>

2015-09-29 17:02:40,793 DEBUG [org.springframework.batch.core.step.item.ChunkOrientedTasklet] - <Inputs not busy, ended: false>

2015-09-29 17:02:40,793 DEBUG [org.springframework.batch.core.step.tasklet.TaskletStep] - <Applying contribution: [StepContribution: read=10, written=10, filtered=0, readSkips=0, writeSkips=0, processSkips=0, exitStatus=EXECUTING]>
2015-09-29 17:02:40782调试[org.springframework.batch.core.step.tasklet.TaskletStep]-
2015-09-29 17:02:40786调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40786调试[org.springframework.batch.core.scope.context.StepContextRepeatCallback]-
2015-09-29 17:02:40786调试[org.springframework.batch.core.scope.context.StepContextRepeatCallback]-
2015-09-29 17:02:40787调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40787调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40791调试[org.springframework.batch.repeat.support.RepeatTemplate]-
2015-09-29 17:02:40793调试[org.springframework.batch.core.step.item.ChunkOrientedTasklet]-
2015-09-29 17:02:40793调试[org.springframework.batch.core.step.tasklet.TaskletStep]-
我的配置有什么问题? 提前谢谢
Giorgio

应用于区块的某些策略(甚至
DefaultResultCompletionPolicy
)正在等待读取结束(
read()
读取器的方法需要在不再读取时返回
null


因此,如果在读取完成后返回
null
(例如,如果
read
方法返回空列表,则步骤将进入无限循环),请检查您的读取器中的
read
方法
collaborationerReader

您找到解决方案了吗?我现在也有同样的问题。