Spring/Batch

[spring batch] job parameter 공백(space) 포함하는 경우.

HANDA개발 2022. 8. 24. 16:42

https://stackoverflow.com/questions/43276454/passing-argument-with-spaces-to-spring-batch-commandlinejobrunner

 

Passing argument with spaces to Spring batch CommandLineJobRunner

In configuring the spring batch jobs, I have a need to pass argument to CommandLineJobRunner which have spaces. For example : java -cp "../../myproject.jar" org.springframework.batch.core.launch.

stackoverflow.com

 

잘못된 예제_

--spring.batch.job.names=insertJob -name=bom kim

위와 같이 파라미터 값에 공백이 발생할 경우, 인자를 2개로 인식하기 때문에 job 파라미터 전체를 ""로 감싸줘야한다.

 

해결_

--spring.batch.job.names=insertJob "-name=bom kim"