Spring Package + Spring Boot Process - Shutdown

I'm new to Spring Batch, and I can't figure out how to complete the Spring boot process after completing the job.

In my BatchConfiguration class, set tasks and steps:

@Configuration
@EnableBatchProcessing
@EnableAutoConfiguration
public class BatchConfiguration {

   @Autowired
   private JobBuilderFactory jobBuilderFactory;

   @Autowired
   private StepBuilderFactory stepBuilderFactory;

   @Autowired
   private MyExecutionListener listener;

   @Autowired
   private MyTasklet step1Task;

   @Bean
   public Job initJob() throws Exception {
        JobBuilder jobBuilder = jobBuilderFactory.get("my-job").incrementer(new RunIdIncrementer())
                .listener(listener);

        FlowBuilder<FlowJobBuilder> builder = jobBuilder.flow(step1()).next(step2()).next(step3());

        return builder.build().build();
    }

    @Bean
    public Step step1() {
       return stepBuilderFactory.get("step1").tasklet(step1Task).build();
    }

    // and so on

After starting the Spring boot application and every step is completed, I still have a process. How can I stop it after completing a task?

+4
source share

Source: https://habr.com/ru/post/1615456/


All Articles