We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47c6bf7 commit ddc5250Copy full SHA for ddc5250
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
@@ -6865,6 +6865,11 @@ implementation:
6865
}
6866
----
6867
6868
+NOTE: `@MockBean` cannot be used to mock the behavior of a bean that's exercised during
6869
+application context refresh. By the time the test is executed, the application context refresh
6870
+has completed and it is too late to configure the mocked behavior. We recommend using a `@Bean`
6871
+method to create and configure the mock in this situation.
6872
+
6873
Additionally, you can use `@SpyBean` to wrap any existing bean with a Mockito `spy`. See
6874
the {dc-spring-boot-test}/mock/mockito/SpyBean.{dc-ext}[Javadoc] for full details.
6875
0 commit comments