Spring batch scope issue while using spring boot

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

    Seeing as you are using @RunWith(SpringRunner.class), declaring @TestExecutionListeners({..., StepScopeTestExecutionListener.class}) above your class will setup the scopes for you.

    Same with @TestExecutionListeners({..., JobScopeTestExecutionListener.class}) for jobScope.

提交回复
热议问题