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

在web-application-config.xml中定义


     
    
 

 结果,运行时出错:

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方法,否则会报错。

你可能感兴趣的:(Java)