Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameter

来源:互联网 发布:xp网络共享 编辑:程序博客网 时间:2024/06/05 06:27

报错:Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameter


解决方法:

public class UrlConstant {
public static String AGENT_URL;

public static String STATISTICAL_URL;

public UrlConstant(String AGENT_URL, String STATISTICAL_URL){
super();
this.AGENT_URL = AGENT_URL;
this.STATISTICAL_URL = STATISTICAL_URL;
}
}


xml:

 <bean id="urlConstant" class="gt.common.UrlConstant">
  <constructor-arg index="0">   
  <value>http://www.baidu1.com</value>
  </constructor-arg>
  <constructor-arg index="1">   
  <value>http://www.baidu2.com</value>
  </constructor-arg>

这样,UrlConstant 中就可以读到xml中配置的值了

阅读全文
0 0
原创粉丝点击