Skippable exception classes for Spring Batch with java based configuration

前端 未结 2 1398
攒了一身酷
攒了一身酷 2021-02-07 22:39

I configure a step in XML like this:


        
            

        
相关标签:
2条回答
  • 2021-02-07 22:55
    @Configuration
    @EnableBatchProcessing
    @Import(DataConfig.class)
        public class SpringBatchConfig {
        ..................
        ..................
        @Autowired
        private StepBuilderFactory stepBuilders;
    
        @Bean
        public Step loadSlaveStep()
            return stepBuilders.get("slaveStep")()
           .chunk()
           .faultTolerant()
           .skip(MyException.class)
           .skipLimit(100000)
           .build() 
    }
    
    0 讨论(0)
  • 2021-02-07 23:03

    You need to build up a FaultTolerantStepBuilder using StepBuilder.faultTolerant method.

    return stepBuilder()
      .chunk()
      .faultTolerant()
      .skip(MyException.class)
      .skipLimit(100000)
    .build()
    
    0 讨论(0)
提交回复
热议问题