This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

I found an issue around step listeners. We have let's say 20 different processes in the application. Each process is separated job defined using batch namespace.

When we are using inner bean in <listener> tag in some step in one job for some reason listener from other job is used. I didn't investigated it so deep, so I have not even know what rules determine this bug. But the fact is that wrong listener is used for the step.
Important could be fact that all these listeners are based on the same class (but different configuration and also on LB values).

causes that not expected listeners are involved. For some reason listener from different job is involved. Wired, I know but it is.

There are 2 workarounds we found:
1. use different classes for inner beans so, based on above example copy classA as classB and use different class for different job. It works than.
2. Define bean outside of job definition and use "ref" tag to point on it:

Code:

<listener ref="someListener"/>

Above is working as well.

For this case we used StepExecutionListener interface. I do not if it's matter but it could be helpfull for investigation. If you cannot reproduce it maybe order of job definitions or order of job executions could have a matter.
My bet is scope='step' problem in listener inner bean which not work properly and creates singleton instead of step prototype.
Just to be clear we are using different beans names/ids for jobs and steps.