org.springframework.beans.NotWritablePropertyException: Invalid property '' of b

悠悠隱於市發表於2011-03-03
org.springframework.beans.NotWritablePropertyException: Invalid property '' of bean class?2009-02-13 15:22
  出現異常的原因是在application-xxx.xml中property name的錯誤。

  <property name="...."> 中name的名字是與bean的set方法相關的,而且要注意大小寫。

  比如

public class PostManageImpl extends BaseManage implements PostManage {
 private PostDAO dao = null;
 public void setPostDAO(PostDAO postDAO){
  this.dao = postDAO;
 }
} 

  那麼xml的定義應該是:

<bean id="postManage" parent="txProxyTemplate">
<property name="target">
 <bean class="com.yz.spring.service.implement.PostManageImpl">
  <property name="postDAO"><ref bean="postDAO"/></property> 對
  <property name="dao"><ref bean="postDAO"/></property> 錯
 </bean>
</property>
</bean> 
 

 

相關文章