-
Notifications
You must be signed in to change notification settings - Fork 2.4k
@StepScope not working when XML namespace activated #3936
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
pull request #3938 |
Hi @benas |
Hi @benas, are there any plans to merge this pull request? we are also affected by this issue and the fix is working for us. |
Yes, we are intending to address this issue and review the attached PR.
@hillebrandt The prefix has been changed from That said, having a bean named |
I believe the issue described by @farnetto is still present. We've encountered the same issue in our project, and was able to reproduce it also in a new project. In our constellation we had an xml file using the We're you able to find out why the strings |
@fmbenhassine any reason the PREFIX wasn't changed for job scoped beans? We still see the duplicate proxy being created for job scoped one? P.S: |
@anthochristen No, if the issue happens with job scoped beans, we should fix it as well. I see you created #4533, thank you for doing that. We will address the issue with the job scope there. |
Uh oh!
There was an error while loading. Please reload this page.
I believe the problem described in the last comment in #1569 still exists: #1569 (comment)
If the Spring Batch XML namespace is loaded with CoreNamespaceUtils, and then you try to define a @StepScope bean in Java e.g. in a Configuration or Component class, then the bean is proxied twice and you get an exception during batch execution:
I have a bean called
scopedTarget.scopedTarget.reader
in my context, which is obviously wrong.The XML namespace creates an instance of StepScope under the name "org.springframework.batch.core.scope.internalStepScope" with autoProxy=true and AbstractBatchConfiguration.ScopeConfiguration creates an instance with autoProxy=false.
There is a check in BatchScopeSupport#postProcessBeanFactory if the bean name starts with the target name prefix, but the value of StepScope.TARGET_NAME_PREFIX doesn't catch it:
stepScopedTarget.
Should StepScope.TARGET_NAME_PREFIX be corrected? I don't see where else it is used.
The text was updated successfully, but these errors were encountered: