Defined in Web-application-config.xml
<bean id= "Employeeservicedest" class= "Com.service.EmployeeServiceImpl" >
<flex:remoting-destination/>
<property name= "Esysdao" ref= "Esysdao"/>
</bean>
As a result, a run-time error occurred:
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]:
The Bean property ' Esyerdao ' was not writable or had an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Among them, "Bean property ' Esyerdao ' are not writable or have an invalid setter method" is a critical error.
Originally, the Set and get methods need to be defined in Employeeserviceimpl.
public void Setesysdao (Esysdao Esysdao) {
This.esyerdao= Esysdao;
}
Public Esysdao Getesysdao () {
return Esysdao;
}
------------------------
Supplementary, case is strictly differentiated, <property name= "Esyerdao" ref= "Esyerdao"/> and <property name= "Esyerdao" ref= "Esyerdao"/> is not the same, for Name= "Esyerdao", define set and get methods in Employeeserviceimpl with lowercase setesysdao and Getesysdao:
public void Setesysdao (Esysdao Esysdao) {
This.esysdao= Esysdao;
}
Public Esysdao Getesysdao () {
return Esysdao;
}
-----------------------------------------------------------------
In addition, each <property name= "xxxx" ref= "xxxxx"/>, you must define the set and get methods in class.
One can not be less, indeed is a meticulous work.
Recently, as a result of the project team needs, began to learn jsf+spring+hibernate.
During the debugging of an online example, exception information such as headers appears during the boot Tomcat process.
Finally, through the analysis of colleagues to find the reason, in the Applicationcontext.xml configuration has a problem, the inside of the Bean property name is wrong.
But in the beginning of the Java file to find.
Some of the contents of the Java file are attached as follows:
public class Loginservice implements Iloginservice
{
Private Logindao Logindao; Here the property is named Logindao
}
But the Applicationcontext.xml is configured as follows:
<bean id= "Loginservice" class= "Vo. Loginservice ">
<property name= "Logindao" >//Here is different from the above name
<ref local= "Logindao" >
</property>
</bean>
After modifying the XML file, the problem is resolved.
Occurs when you use spring injection when the is not writable or have an invalid setter method