Reputation: 75
Working on a Spring Boot Job. Using this example https://spring.io/guides/gs/batch-processing.
Job runs and I can run it through IDE or command line by calling the jar file.
But I need to be able to pass in command line arguments to the batch job. Googling shows I may be able to call the jar with args, but to keep standard in the organization, I need to call either the jar or prefer to call CommandLineJobRunner via a shell script. Googling on this topic brings back lots of incorrect information. Can anyone assist in using Spring Batch within Spring Boot and passing in good arguments that can drive my batch job?
Upvotes: 0
Views: 1071
Reputation: 2146
Spring boot applications create executable jar using maven plugin and that jar can be executed using
Java -jar jarname.jar.
And when we execute jar using above command then it call main function, if we will pass arguments along with above command then it will go in main fuction argument and those arguments can be used in bean for batches.
Upvotes: 1