Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

Spring 依赖注入(hint: specify index and/or type arguments for simple parameters to avoid type ambiguiti)

$
0
0
<bean id="feeCodeSogouConfig"
class="com.sech.zengzhi.service.config.FeeCodeSogouConfig">
<constructor-arg>
<ref bean="userService" />

</constructor-arg>

<constructor-arg>
<ref bean="advertisingService" />
</constructor-arg>

<property name="searchDataService">
<ref local="searchDataService" />
</property>
<property name="sysConfig">
<ref local="sysConfig" />
</property>

</bean>


错误信息:16:37:18,109 ERROR ContextLoader:205 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'feeCodeSogouConfig' 
defined in ServletContext resource [/WEB-INF/applicationContext.xml]: 2 constructor arguments specified but no 
matching constructor found in bean 'feeCodeSogouConfig' 
(hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)


原因是

构造函数写错了..注入的时候找不到构造函数
public FeeCodeSogouConfig(UserService userService,AdvertisingService advertisingService) {
		logger.debug("initializes....");
		this.userService = userService;
		this.advertisingService=advertisingService;
		this.loadUserCodes();
}
加上红色的问题解决

作者:qdgengwenfei 发表于2013-1-14 16:39:06 原文链接
阅读:25 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>