spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.31k stars 40.71k forks source link

@MockitoSpyBean behavior different from @SpyBean #43245

Closed tobias-lippert closed 19 hours ago

tobias-lippert commented 19 hours ago

Version: Spring Boot 3.4.0-RC1 Hi Spring team,

I'm not sure if this belongs to Spring Boot or Spring framework since the new annotation is part of the Spring framework but the old annotation is part of Spring Boot. Previously, when using @SpyBean I did not have to create a bean instance in my test context to spy on it. This is now different as stated in the docs and the blog post (https://docs.spring.io/spring-framework/reference/testing/annotations/integration-spring/annotation-mockitobean.html). If this is intended behavior, feel free to close this issue since it is clearly documented.

Otherwise, I can create a reproducer, I think.

wilkinsona commented 19 hours ago

This is the intended behavior. If you'd like to see Spring Framework behave differently, you'll need to open a Spring Framework issue.

tobias-lippert commented 19 hours ago

Thanks @wilkinsona . Gonna raise an issue there, to see what they think.