Spring batch scope issue while using spring boot

前端 未结 6 1187
感动是毒
感动是毒 2020-11-30 05:13

I\'m having Standalone spring batch job. This works perfectly fine when in JUNIT

@RunWith(SpringJUnit4ClassRunner.class)
//@SpringApplicationConfiguration(cl         


        
6条回答
  •  自闭症患者
    2020-11-30 05:34

    Michael's comment is working for me, I am also providing JavaConfig copy-paste alternative for lazy people like me :)

    @Bean
    public StepScope stepScope() {
        final StepScope stepScope = new StepScope();
        stepScope.setAutoProxy(true);
        return stepScope;
    }
    

提交回复
热议问题