how to stop spring batch scheduled jobs from running at first time when executing the code?

前端 未结 4 1513
有刺的猬
有刺的猬 2020-12-28 15:53

i\'m using spring batch 2.2.4 with quartz to run some jobs at certain time

the problem is the jobs always run after executing the code at the first time then it runs

4条回答
  •  清歌不尽
    2020-12-28 16:51

    To solve this you will have to create one more properties file and name it "batch.properties".

    # Disable batch auto-start
    spring.batch.job.enabled=false
    

    You can give the reference to this file from your java configuration file.

    Sample:

    @Configuration
    @ComponentScan("com.code")
    @EnableBatchProcessing
    @PropertySource("classpath:batch.properties")
    public class AppConfig {
    
    }
    

    @PropertySource("classpath:batch.properties")

    Hope this helps.

提交回复
热议问题