Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove support for running multiple Spring Batch jobs #25373

Closed
wilkinsona opened this issue Feb 19, 2021 · 1 comment
Closed

Remove support for running multiple Spring Batch jobs #25373

wilkinsona opened this issue Feb 19, 2021 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Feb 19, 2021

As discussed as part of #23411, running multiple Batch jobs does more harm than good, as @benas summarised nicely:

I would not continue the support for running multiple jobs at the same time, because this is problematic in many ways: Same arguments are passed to all jobs (as mentioned by Stephane), mixed logs, ambiguous job execution order(ing), confusing exit code, etc. I can elaborate on each of those, but I believe there are obvious reasons why the current behaviour is confusing. So following the unix philosophy of making one thing do one thing and do it well, I would change the current behaviour to run a single job at a time.

We can continue supporting packaging multiple jobs in the application, but when that's the case we should require users to identify via a property which one job they want to be launched. This will require us to deprecate spring.batch.job.names and replace it with spring.batch.job.name (or spring.batch.job-name).

@hpoettker
Copy link
Contributor

For the use case of multiple jobs packaged in the same application, it would be a great enhancement if lazy initialization for the job beans worked (more or less) out of the box. Ideally, only the beans required for the requested job are actually initialized while all other job beans and their dependencies remain uninitialized. For larger applications, this should yield a sizeable improvement of the application start-up time.

Currently, job configuration classes can be explicitly marked as @Lazy or the property spring.main.lazy-initialization can be set to true. However, all job beans will nevertheless be initialized when injected into JobLauncherApplicationRunner::setJobs or latest when Job::getName is called on the job beans, respectively.

@philwebb philwebb modified the milestones: 2.x, 3.0.x May 4, 2022
@philwebb philwebb changed the title Deprecate support for running multiple Spring Batch jobs Remove support for running multiple Spring Batch jobs May 4, 2022
@mbhave mbhave self-assigned this Jun 9, 2022
@mbhave mbhave modified the milestones: 3.0.x, 3.0.0-M4 Jun 15, 2022
@mbhave mbhave closed this as completed in 55d6a87 Jun 15, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants