org.springframework.beans.NotWritablePropertyException

まあ、そのへんよく調べないでやってんのが悪いんだけど。

間違った設定

public class Man {
    private String name;

    public String getName() {
        return this.name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
}

こうやって書いておいて

<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-2.5.xsd">

    <bean id="man" class="Man">
        <property name="name"><value>ねこ</value></property>
    </bean>
</beans>

でこう呼び出すと

ApplicationContext context = new ClassPathXmlApplicationContext("hoge.xml");
Man man = (Man) context.getBean("man");

エラーに成っちゃうので、

正しい設定

<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-2.5.xsd">

    <bean id="man" class="Man">
        <property name="Name"><value>ねこ</value></property>
    </bean>
</beans>
public class Man {
    private String Name;

    public String getName() {
        return this.Name;
    }
 
    public void setName(String Name) {
        this.Name = Name;
    }
}

こうすると通った。まだコード詳しく追ってないからわかんないけど。
プロパティ名まで強制されるんかこれ。