0
package com.protect.shapes;
public class Triangle {
String Type = null;
String type = null;
public String getType() {
return Type;
}
public void setType(String Type) {
this.Type = Type;
}
public String gettype() {
return type;
}
public void settype(String type) {
this.type = type;
}
public void draw() {
System.out.println("Drawing " + type + " Triangle. " + Type);
}
}
Configuration file.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Project beans go here -->
<bean id="triangle" class="com.protect.shapes.Triangle">
<property name="Type" value="Equilateral">
</property>
</bean>
我試圖檢查Spring是如何處理區分大小寫的屬性名稱,但不能弄明白:同時爲type
和Type
領域我把我得到的結果相同如何解析Spring區分大小寫的屬性名稱
"Drawing Equilateral Triangle. null".
您能否介紹一下爲什麼以及如何實例化Type
字段。