This is a cross post of https://github.com/spring-projects/spring-framework/issues/33934 - I think it's useful to mention here.
I believe most people will run into this issue for the first time when upgrading to Spring Boot 3.4.
At a high level @MockitoBean is no longer behaving the same as @MockBean was when used in tests.
The examples in https://github.com/spring-projects/spring-framework/issues/33934 as well as my experience are specifically referencing @WebMvcTest (which is from Spring Boot and why I think this should be brought up here).
Shout out to @tobias-lippert for the initial post with a solid example.
Ideally @MockitoBean would be a drop-in replacement for @MockBean and those test-specific configuration classes would continue to work. Alternatively I think it would be useful to document the need to move those @MockitoBean declarations to the test class itself.
Comment From: wilkinsona
I've added a section to the release notes. Beyond that, constructive feedback should be provided in the Spring Framework issue tracker as that's where any changes will be considered and potentially made.
Comment From: adase11
Thanks!