是否可以執行步驟或跳過它並根據彈簧批次中的某些條件繼續下一步驟。 例如在批處理作業中有5個步驟,並且在每個步驟執行前,我們需要檢查是否跳過它,具體取決於數據庫中列的值。 要求是通過偵聽器或其他可以在運行時控制步驟執行的方式創建通用邏輯?春季批次中的控制步驟級別執行
我需要在運行時填充下一個屬性。示例XML:
<batch:step id="step1" next="stepdecision">
<batch:tasklet ref="tasklet1" />
</batch:step>
<batch:step id="step2" next="stepdecision">
<batch:tasklet ref="tasklet1" />
</batch:step>
<batch:step id="step3" next="stepdecision">
<batch:tasklet ref="tasklet1" />
</batch:step>
<batch:step id="step4" next="stepdecision">
<batch:tasklet ref="tasklet1" />
</batch:step>
<batch:decision id="stepdecision" decider="decider">
<batch:next on="next" to="#{jobExecutionContext[nextStep]}" />
</batch:decision>
</batch:job>
<bean id="decider" class="com.bmo.apms.batch.StepFlowDecider">
</bean>
<bean id="tasklet1" class="com.bmo.apms.batch.TestTasklet" />
但它引發異常: 配置問題:元素[第二步]不可達|
我覺得spring不允許在運行時綁定下一個屬性。 請指教。
http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/core/job/flow/JobExecutionDecider.html –