我试图使用 Spring 3.1 配置文件和 EasyMock 来模拟 HttpClient 实现,但 Spring 容器抱怨它找不到正确类型的 bean。我是否配置了错误的模拟?如果我用正确注入的实际实现替换 EasyMock bean,那么 EasyMock 方法似乎没有创建正确类型的 bean。非常感谢所有帮助!
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.http.client.HttpClient] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:986)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:856)
<beans profile="development,developmentthomas,test,integration,webtest,accept">
<bean id="httpClient" class="org.easymock.EasyMock" factory-method="createMock">
<constructor-arg value="org.apache.http.client.HttpClient" />
</bean>
</beans>
<beans profile="thomasciserver,testserverlocaloleg,testservercioleg,preprod,production,testservercithomas,testserverlocalthomas,localthomasclean,testserver,productionthomas">
<bean id="httpClient" class="org.apache.http.impl.client.DefaultHttpClient"/>
</beans>