-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Different behavior of JobExecutionDecider when using @Configuration or @AutoConfiguration / proxyBeanMethods=false #4429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @ck-trigfb, you can disable proxying of bean methods for your configuration classes by either setting You use the following factory method for your job:
To see your expected sequence of steps, you rely on that the invocation of As If you want to disable the proxying (for whatever reason), you should stop calling other |
@ck-trigfb Thank you for reporting this issue and for providing an example. While this seems to be due to a difference in the behaviour of the job execution decider, it is rather related to the proxying of bean definition methods which impacts the flow definition. In fact, step instances must be unique within a flow definition, and this was not clearly documented. When bean method proxying is disabled, calling the same step As part of #4460, the reference documentation was updated with this important detail (see note "Step bean method proxying in flow definitions" in Controlling Step Flow. The samples in that same page were also updated to inject steps as parameters of job definition methods to avoid any confusion. I am closing this issue as superseded by #4460, but feel free to add a comment if you need more support on this. |
Bug description
When using
@AutoConfiguration
the JobExecutionDecider will behave different than when just using@Configuration
. Because@AutoConfiguration
is@Configuration(proxyBeanMethods=false)
you will get the same result with that setting.If I use
@Configuration(proxyBeanMethods=true)
I will get for my attached example the following order of my steps: step1, step2, step3.If I use
@Configuration(proxyBeanMethods=false)
I only get : step1, step2. So the Flow seems to be ended after the JobExecutionDecider.Environment
Spring Batch 5.0.2, Java Version: 17.0.6, H2-Database
Steps to reproduce
Run attached project first with
@Configuration
and after that with@AutoConfiguration
instead.Expected behavior
Same behavior in the order of the execution of the steps.
Minimal Complete Reproducible example
Sample attached.
autoconfissue.zip
The text was updated successfully, but these errors were encountered: