-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Closed
Copy link
Labels
type: regressionA regression from a previous releaseA regression from a previous release
Milestone
Description
I think this fix 52050c1 for this issue #17817 has created another issue.
When I try to use @SpyBean
on @StepScope
bean Spring Boot Test is failing with BeanCreationException
. I use mockito-inline
to allow spying on proxied class (step scope bean) to stub behaviour. This worked with spring-boot 2.1.7.RELEASE
, but stopped working with 2.1.8.RELEASE
and onwards.
org.springframework.beans.factory.BeanCreationException: Could not inject field:
step.scope.spy.bean.batch.MyItemWriter step.scope.spy.bean.JobControllerIT.myItemWriter;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'scopedTarget.writer':
Scope 'step' is not active for the current thread;
consider defining a scoped proxy for this bean if you intend to refer to it from a singleton;
nested exception is java.lang.IllegalStateException:
No context holder available for step scope
Example code to replicate the issue - https://github.com/elxnis/spring-boot-step-scope-spy-bean-issue
Metadata
Metadata
Assignees
Labels
type: regressionA regression from a previous releaseA regression from a previous release