使用spring注入时出现is not writable or has an invalid setter method

在web-application-config.xml中定义

<bean id="employeeServiceDest" class="com.service.EmployeeServiceImpl">
      <flex:remoting-destination />
    <property name="EsysDao" ref="EsysDao"/>
 </bean>

 结果,运行时出错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeServiceDest' defined in ServletContext resource [/WEB-INF/web-application-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'esyerDao' of bean class [com.service.EmployeeServiceImpl]:

 Bean property 'esyerDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

个人理解spring中的bean标签用来给类创建对象,property相当于类中的属性,如果类要使用属性的话,需要在该类中生成get和set方法,否则会报错。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章