EDIT
I created a test project that replicates the issue. It can be found at https://github.com/tomverelst/test-batch.
First run the maven co
I can not provide you an actual answer (yet), but I've debugged the example you have provided and this is happening:
@Configuration
definition reader sees @StepScope
annotation which is annotated with @Scope(value = "step", proxyMode = ScopedProxyMode.TARGET_CLASS)
reader
while the original bean is registered as scopedTarget.reader
.StepScope
kicks in and post-processes step
scoped beans. It detects the CGLIB extended reader
definition and tries to create proxy for that => ERROR.There are two proxying mechanisms in conflict. There is something really weird going on and it seems to me that this can never work. Will try to search through Spring JIRA.
UPDATE
Found solution - you need to disable auto-proxying for the step scope: