这是代码:
public class Triangle {
private String color;
private int height;
public Triangle(String color,int height){
this.color = color;
this.height = height;
}
public Triangle(int height ,String color){
this.color = color;
this.height = height;
}
public void draw() {
System.out.println("Triangle is drawn , +
"color:"+color+" ,height:"+height);
}
}
Spring 配置文件是:
<bean id="triangle" class="org.tester.Triangle">
<constructor-arg value="20" />
<constructor-arg value="10" />
</bean>
是否有任何特定规则来确定 Spring 将调用哪个构造函数?