Posts

Showing posts with the label spring-batch

How to start specific spring batch job with command line

How to start specific spring batch job with command line I have two configured jobs in my spring boot application. I want to trigger a job manually, using a command in my docker-compose.yml to trigger it. To accomplish this first I disable the batch.job.enabled property in my application.yml: batch: initialize-schema: always job: enabled: false I disable it in order to not allow Spring to execute my jobs on application startup. I'm trying to test my jobs with docker, so in my docker-compose.yml I set this command on my application service to execute when my container is up: command: java -jar batch-application-1.0-SNAPSHOT.jar -Dspring.batch.job.names=uploadToS3Job date=2018-06-26 type=MyType This command runs the uploadToS3Job with job parameters date and type. uploadToS3Job When I run my application with docker-compose up --build , spring application runs smoothly but the job is not executed, nothing happens, no crash, no nothing. docker-compose up --build But if I s...