当从Maven运行Spring Batch时,如何设置作业参数?

huangapple go评论66阅读模式
英文:

When running spring batch from maven, how do you set job parameters?

问题

如果我想发送作业参数,我该如何完成?

英文:

Lets say you run a spring batch program from maven:

mvn spring-boot:run -Dspring.batch.job.names=MyJobNameHere

What if I want to send job parameters? How would I accomplish that?

答案1

得分: 1

这个答案中,我发现你可以使用以下方式将参数发送到Spring Boot应用程序中:

-Drun.arguments="param1=value1 param2=value2"

示例:

mvn spring-boot:run -Dspring.batch.job.names=jobNameHere -Drun.arguments="arg=val arg2=val2" -f pom.xml

在运行Spring Batch时,似乎同样的技巧有效。

英文:

From this answer, I found you can send parameters into a spring boot application using

-Drun.arguments="param1=value1 param2=value2"

Example:

mvn spring-boot:run -Dspring.batch.job.names=jobNameHere -Drun.arguments="arg=val arg2=val2" -f pom.xml

When running a Spring Batch, that same technique seems to work.

huangapple
  • 本文由 发表于 2023年5月31日 22:35:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76374627.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定