BeanCreationException:Does the parameter type of the setter match the return type of the getter

来源:互联网 发布:福建广电网络书记 编辑:程序博客网 时间:2024/05/16 06:00


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [dxm.com.dao.imp.UserDaoImp]: Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1429)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1134)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)




========================



根据 错误信息提示 显然是 sessionFactory没有get, set方法。加上就ok啦。get方法无所谓,set方法必须有,spring注入注入!!set方法是注入的通道。从方法体就可以看出来。


public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;

0 0
原创粉丝点击