You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 spring-projects/spring-framework#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.