Spring batch scope issue while using spring boot

前端 未结 6 1198
感动是毒
感动是毒 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:50

    This may be a bug (we're still investigating), however we do have a work around. The cause of this is that when using @EnableBatchProcessing the StepScope that is automatically configured assumes java config and therefore does not proxy the step scoped beans, causing them to be created too soon. The work around is to manually configure a StepScope in your XML configuration with the following configuration:

    
        
    
    

提交回复
热议问题