Overview
Spring Boot has honored @Primary
for @MockBean
and @SpyBean
since Spring Boot 1.4.3; however, the support for @Primary
was lost when the @MockBean
/@SpyBean
support was ported from Spring Boot to Spring Framework's new Bean Overrides feature in the TestContext framework.
Since the lack of this support constitutes a regression for anyone migrating from @MockBean
/@SpyBean
to @MockitoBean
/@MockitoSpyBean
, I have labeled this issue as a "bug".
Related Issues
-
33742
- https://github.com/spring-projects/spring-boot/issues/7621