1
votes

I am trying to launch a job from inside a step (the execute method of a class implementing the interface Tasklet).

Obviously i received the exception

java.lang.IllegalStateException: Existing transaction detected in JobRepository

How to make a spring batch step not transactional?

Does anyone have a solution to my main need of launching a job from inside a step?

Thanks in advance for the help!

1
I added an answer back then, please accept it if it helped: stackoverflow.com/help/someone-answers. Thank you.Mahmoud Ben Hassine

1 Answers

1
votes

How to make a spring batch step not transactional?

You can set a ResourcelessTransactionManager on your step. Think of it as a NoOp transaction manager.

Does anyone have a solution to my main need of launching a job from inside a step?

The JobStep is specifically designed for this use case. It is a Step implementation that delegates to a Job.

Hope this helps.