Annotation Interface MockitoSpyBean
By default, the bean to spy is inferred from the type of the annotated
 field. If multiple candidates exist, a @Qualifier annotation can be
 used to help disambiguate. In the absence of a @Qualifier annotation,
 the name of the annotated field will be used as a fallback qualifier.
 Alternatively, you can explicitly specify a bean name to spy by setting the
 value or name attribute. If a bean name is
 specified, it is required that a target bean with that name has been previously
 registered in the application context.
 
A spy cannot be created for components which are known to the application
 context but are not beans — for example, components
 registered directly as resolvable dependencies.
 
NOTE: Only singleton beans can be spied. Any attempt
 to create a spy for a non-singleton bean will result in an exception. When
 creating a spy for a FactoryBean,
 a spy will be created for the object created by the FactoryBean, not
 for the FactoryBean itself.
- Since:
- 6.2
- Author:
- Simon Baslé, Sam Brannen
- See Also:
- 
Optional Element SummaryOptional Elements
- 
Element Details- 
valueAlias forname().Intended to be used when no other attributes are needed — for example, @MockitoSpyBean("customBeanName").- See Also:
 - Default:
- ""
 
- 
nameName of the bean to spy.If left unspecified, the bean to spy is selected according to the annotated field's type, taking qualifiers into account if necessary. See the class-level documentation for details. - See Also:
 - Default:
- ""
 
- 
resetMockReset 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
 
 
-