<property name="...."> 中name的名字是与bean的set方法相关的,而且要注意大小写

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


Sql代码   收藏代码
  1. org.springframework.beans.NotWritablePropertyException: Invalid property '' of bean class?2009-02-13 15:22  
  2.   出现异常的原因是在application-xxx.xml中property name的错误。  
  3.   
  4.   <property name="...."> 中name的名字是与bean的set方法相关的,而且要注意大小写。  
  5.   
  6.   比如  
  7.   
  8. public class PostManageImpl extends BaseManage implements PostManage {  
  9.  private PostDAO dao = null;  
  10.  public void setPostDAO(PostDAO postDAO){  
  11.   this.dao = postDAO;  
  12.  }  
  13. }   
  14.   
  15.   那么xml的定义应该是:  
  16.   
  17. <bean id="postManage" parent="txProxyTemplate">  
  18. <property name="target">  
  19.  <bean class="com.yz.spring.service.implement.PostManageImpl">  
  20.   <property name="postDAO"><ref bean="postDAO"/></property> 对  
  21.   <property name="dao"><ref bean="postDAO"/></property> 错  
  22.  </bean>  
  23. </property>  
  24. </bean>   

你可能感兴趣的:(java)