Change Summary
- Deprecate Deprecate @MockBean and @SpyBean in favor of Spring Framekworks 6.2.0 @MockitoBean and @MockitoSpy. See https://github.com/spring-projects/spring-framework/commit/e1bbdf09139dca7c21ec64e140bcc3bda463b2f6
- Migrate usages of @MockBean and @SpyBean to @MockitoBean an d @MockitoSpy
Issue
- https://github.com/spring-projects/spring-boot/issues/39860
Comment From: snicoll
FTR, I am maintaining a branch of the changes required to upgrade to SF 6.2.0-SNAPSHOT
and some of the changes in this PR are already applied there, which I intend to submit once Spring Boot is ready to build against it.
Comment From: wanger26
Closing PR /draft based on comments above.
Comment From: philwebb
@wanger26 Can we keep this one? It's likely that @snicoll won't migrate the existing tests and the work you've done here looks valuable for us.
Comment From: wanger26
Sounds good, that is no problem 👍
Comment From: snicoll
Here is what's needed so far to get a green build with Spring Framework 6.2.0-SNAPSHOT
: https://github.com/snicoll/spring-boot/tree/compat-6.2.x
Regarding Mockito support, I had to remove the automatic intialization of mocks as the support in the core framework does that now and they were trumping each other. Given that the support is going to be deprecated, tests should still use the existing infrastructure, rather than moving to the new annotations. It's a different story for smoke tests & co though.
Comment From: wanger26
Here is what's needed so far to get a green build with Spring Framework
6.2.0-SNAPSHOT
: https://github.com/snicoll/spring-boot/tree/compat-6.2.xRegarding Mockito support, I had to remove the automatic intialization of mocks as the support in the core framework does that now and they were trumping each other. Given that the support is going to be deprecated, tests should still use the existing infrastructure, rather than moving to the new annotations. It's a different story for smoke tests & co though.
Should we leave all tests using the Mockito outside of smoke tests and co untouched, or should we only leave the unit tests for the Mockito support untouched?
Comment From: wilkinsona
Thank you, @wanger26.