Springboot 集成 SpringBatch时,由于我执行的step太多了,偶尔还需要灵活配置执行哪些step,所以我选择了在XML中配置 batch:job,但是在reader/processor上增加 scope="step"时,启动提示 “No context holder available for step scope”

 

查了下文档,实际上时需要自己定义下 stepscope,可以在前面增加如下配置,再使用scope="step"就不会有问题了

<bean class="org.springframework.batch.core.scope.StepScope" />

 

 

如果是定义jobscope,则使用 

<bean class="org.springframework.batch.core.scope.JobScope" />

 

更多推荐

No context holder available for step scope 解决办法