Annotation Interface MockitoSpyBean
If no explicit name() is specified, a target bean is selected
according to the class of the annotated field, and there must be exactly one
such candidate bean.
If a name() is specified, it is required that a target bean of that
name has been previously registered in the application context.
Dependencies that are known to the application context but are not beans
(such as those
registered directly) will not be found.
- Since:
- 6.2
- Author:
- Simon Baslé
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe name of the bean to spy.booleanIndicates that Mockito methods such asverify(mock)should use thetargetof AOP advised beans, rather than the proxy itself.The reset mode to apply to the spied bean.
-
Element Details
-
name
String nameThe name of the bean to spy.If left unspecified, the bean to override is selected according to the annotated field's type.
- Returns:
- the name of the spied bean
- Default:
- ""
-
reset
MockReset resetThe reset mode to apply to the spied bean.The default is
MockReset.AFTERmeaning that spies are automatically reset after each test method is invoked.- Returns:
- the reset mode
- Default:
- AFTER
-
proxyTargetAware
boolean proxyTargetAwareIndicates that Mockito methods such asverify(mock)should use thetargetof AOP advised beans, rather than the proxy itself.Defaults to
true.If set to
falseyou may need to use the result ofAopTestUtils.getUltimateTargetObject(...)when calling Mockito methods.- Returns:
trueif the target of AOP advised beans is used, orfalseif the proxy is used directly
- Default:
- true
-