使用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方法,否則會報錯。

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