Reputation: 1478
I'm working with spring boot 2.3 and I've some spring batch configurations inside it.
Currently if I want to run a spring batch process I've used the following approach
Spring batch job configuration
@Configuration("myJobConf")
@JobReference("myJob")
public class MyJob
application.yml
spring:
batch:
job:
enabled: true
names: ${JOB_NAME}
And when I want to launch the spring batch process from the command line I run
java -jar mySpringBootApplication.jar -DJOB_NAME=myJob
But now I need to pass some job parameters also. How can I do that?
Thank you
Upvotes: 1
Views: 1425
Reputation: 31600
But now I need to pass some job parameters also. How can I do that?
You can pass job parameters as key/value pairs:
java -jar mySpringBootApplication.jar -DJOB_NAME=myJob param1=value1 param2=value2
You can find more details in the Batch Applications -> Running from the Command Line section of the reference documentation.
Upvotes: 3