错误信息:Bean property 'sessionFactory' is not writable or has an invalid setter method.(Springm
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误信息:Bean property 'sessionFactory' is not writable or has an invalid setter method.(Springm相关的知识,希望对你有一定的参考价值。
是在建立class的时候对应的set方法和spring配置文件的不一样
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;
其中加黑的部分要对应起来,不然启动tomcat启动时就会出现这个错误的信息。
<!-- Goods类 -->
<bean id="goodsDao" class="cn.lion.dao.GoodDAO">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 代理事务 -->
<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>
以上是关于错误信息:Bean property 'sessionFactory' is not writable or has an invalid setter method.(Springm的主要内容,如果未能解决你的问题,请参考以下文章
网上下载的dubbo-admin控制台程序启动报错Bean property 'URIType' is not writable
Invalid property 'url' of bean class com mchange v2 c3p0 Co
dubbo java环境下出现Cannot resolve reference to bean 'carDao' setting bean property 'carDao
dubbo-admin-2.5.3 运行报错: Bean property 'URIType' is not writable or has an invalid
两招解决异常_Cannot find any information on property 'XXX' in a bean of type 'XXX'的问题