Oussama Zoghlami
Oussama Zoghlami

Reputation: 1708

Is there a spring batch "job" scope?

I just want to know if there is a "JOB" scope in spring batch, like the "STEP" scope ? If there is not, should we develop our custom scope, or is there a better alternative ?

Thanks in advance.

Upvotes: 9

Views: 9752

Answers (3)

Oussama Zoghlami
Oussama Zoghlami

Reputation: 1708

Finally Spring Batch 3.0 supports now the Job Scope : What's new in Spring Batch 3.0

Upvotes: 5

Raphaël Brugier
Raphaël Brugier

Reputation: 480

A jira has been opened some times ago on the spring batch issues tracker regarding this issue: https://jira.springsource.org/browse/BATCH-1701

A pull request has been submitted as well, hopefully it will be merge soon, because I have this use case too: https://github.com/SpringSource/spring-batch/pull/41

There are multiple workarounds in the mean time, each with its drawback, see this answer on stackoverflow: https://stackoverflow.com/a/8121102/470107

Upvotes: 6

Michael Pralow
Michael Pralow

Reputation: 6630

if your dataHolder bean holds state you could try it with a proper bean scope e.g. prototype

Upvotes: 0

Related Questions