Overview
Due to the deprecation of @MockBean and @SpyBean in favor of Spring Framework's new @MockitoBean and @MockitoSpyBean support, several users have raised issues in the Spring Framework issue tracker regarding incompatibilities between the two sets of annotations.
Although incompatibilities are to be expected, it is not immediately clear to users what the differences are.
To address that, the Framework team proposes that the Boot team introduce a new section in the Mocking and Spying Beans section of the reference docs that lists known differences and potential migration strategies.
This could perhaps be addressed via a "compatibility matrix" for the 4 annotations.
Since the deprecation of @MockBean and @SpyBean and the migration to @MockitoBean and @MockitoSpyBean are specific to Boot, the Framework team feels the migration/compatibility documentation would best reside in Boot's reference docs.
Ideally, members of the Boot and Framework teams could collaborate on compiling the compatibility matrix, and I'd be happy to assist with that.
Related Issues
-
43282
- https://github.com/spring-projects/spring-framework/issues/33925
- https://github.com/spring-projects/spring-framework/issues/33934
- https://github.com/spring-projects/spring-framework/issues/33935
- etc.
Comment From: snicoll
the Framework team proposes that the Boot team introduce a new section in the Mocking and Spying Beans section of the reference docs
I don't recall such a discussion. FWIW, I believe that the reference documentation is the wrong place for this as it is related to upgrade considerations. Before we get going, we would need to see what if, if any, will be implemented in Spring Framework.
Comment From: philwebb
I agree with @snicoll, we generally keep this kind of thing out of the reference docs. However, we could either improve our release notes or add another "migrating" page to the wiki.
Comment From: philwebb
Putting on hold for a little while because we'd like to know how https://github.com/spring-projects/spring-framework/issues/33925 will play out.
Comment From: philwebb
https://github.com/spring-projects/spring-framework/issues/33925 has now been fixed.