Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Spring Batch Jobs

Tags:

spring-batch

I was wondering if there's a way to enable/disable all of defined spring-batch jobs programmatically? For instance when I deploy my app, the database is empty and at that moment my jobs are running and throwing exceptions. I would like to have the jobs disabled until some data is populated in the database (until certain tables appear). Is this possible?

like image 725
Petar Tahchiev Avatar asked Sep 14 '25 03:09

Petar Tahchiev


1 Answers

Have you take a look at this question? How Spring Boot run batch jobs You can disable the job at startup by adding spring.batch.job.enabled=false to application.propertiesfile.
Then you can use the JobLauncher to run the job when your database is initialised.

like image 193
Saman Avatar answered Sep 16 '25 23:09

Saman