GH-795 - Using @MockitoBean and @MockitoSpyBean.

This commit is contained in:
K. Siva Prasad Reddy
2024-09-02 20:06:15 +05:30
committed by Oliver Drotbohm
parent 5d57e2ce0f
commit 2b6a0bebf2
12 changed files with 27 additions and 27 deletions

View File

@@ -90,7 +90,7 @@ Java::
@ApplicationModuleTest
class InventoryIntegrationTests {
@MockBean SomeOtherComponent someOtherComponent;
@MockitoBean SomeOtherComponent someOtherComponent;
}
----
Kotlin::
@@ -100,11 +100,11 @@ Kotlin::
@ApplicationModuleTest
class InventoryIntegrationTests {
@MockBean SomeOtherComponent someOtherComponent
@MockitoBean SomeOtherComponent someOtherComponent
}
----
======
Spring Boot will create bean definitions and instances for the types defined as `@MockBean` and add them to the `ApplicationContext` bootstrapped for the test run.
Spring Boot will create bean definitions and instances for the types defined as `@MockitoBean` and add them to the `ApplicationContext` bootstrapped for the test run.
If you find your application module depending on too many beans of other ones, that is usually a sign of high coupling between them.
The dependencies should be reviewed for whether they are candidates for replacement by publishing xref:events.adoc#events[domain events].