当前位置:编程学习 > JAVA >>

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

<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 易做图 parameters to avoid type ambiguities)
 
 
原因是
 
构造函数写错了..注入的时候找不到构造函数
public FeeCodeSogouConfig(UserService userService,AdvertisingService advertisingService) {
logger.debug("initializes....");
this.userService = userService;
this.advertisingService=advertisingService;
this.loadUserCodes();
}
加上红色的问题解决
补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,