向春豆中注入Mockito模拟
@Autowired
ReflectionTestUtils.setField
<bean id="dao" class="org.mockito.Mockito" factory-method="mock"> <constructor-arg value="com.package.Dao" /></bean>
...Caused by: org...NoSuchBeanDefinitionException: No matching bean of type [com.package.Dao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: { @org...Autowired(required=true), @org...Qualifier(value=dao) }at org...DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(D...y.java:901)at org...DefaultListableBeanFactory. doResolveDependency(D...y.java:770)
constructor-arg
尚方宝剑之说