The corresponding set method is not the same as the spring configuration file when the class is created
public class Goodsservice implements igoodsservice{
Private Igooddao Goodsdao;
public void Setgoodsdao (Igooddao Goodsdao) {
This.goodsdao = Goodsdao;
}
}
public class Gooddao implements igooddao{
Private sessionfactory sessionfactory;
public void Setsessionfactory (Sessionfactory sessionfactory) {
This.sessionfactory = sessionfactory;
}
}
@Resource (name= "Goodsservice")
Private Igoodsservice Goodsservice;
The black part should correspond, otherwise this error message will appear when starting Tomcat.
<!--goods Class--
<bean id= "goodsdao" class= "Cn.lion.dao.GoodDAO" >
<property name= "Sessionfactory" ref= "Sessionfactory" ></property>
</bean>
<!--agent Transactions--
<bean id= "Goodsservicebase" class= "Cn.lion.service.GoodsService" >
<property name= "Goodsdao" ref= "Goodsdao" ></property>
</bean>
<bean id= "goodsservice" parent= "Transactionbese" >
<property name= "target" ref= "Goodsservicebase" ></property>
</bean>
Error message: Bean property ' Sessionfactory ' was not writable or had an invalid setter method. (SPRINGMVC)