简体   繁体   中英

Can we pass parameters between two jobs in spring batch which run via spring boot application

Is there way to pass parameters that are set in first job to second spring job. I am not talking about steps here, I know with executionCOntext I can pass between two steps , how about two jobs in spring batch.

Thanks

You could pass a reference to the JobRepository to your Job class (either in the constructor of via @Autowired ).

It´sa weird setup, but with that you could access details about other Jobs parameters and execution. Bear in mind that you might encounter race conditions if the Jobs you are checking are still running.

See the docs about the JobRepository here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM