诡异的错误,明明注入了sessionFactory,还是报sessionFactory' or 'hibernateTemplate' is required

丶浅 2014-08-15 12:55:49
以下是配置文件:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
</props>
</property>
</bean>
<bean id="whouseDao" class="lux.dao.impl.WhouseDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="whouseService" class="lux.service.impl.WhouseServiceImpl">
<property name="whouseDao">
<ref bean="whouseDao" />
</property>
</bean>
<bean id="whouseAction" class="lux.action.WhouseAction">
<property name="whouseService">
<ref bean="whouseService" />
</property>
</bean>
以下是报错内容:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'whouseService' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

一共建了好几个和whouse类似的bean,配置都一样,别的都不报错,把whouse注释了之后也没问题。
请大家帮忙解决。
...全文
196 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanghongjy 2014-08-15
  • 打赏
  • 举报
回复
异常信息和 whouseService 贴出来看看
丶浅 2014-08-15
  • 打赏
  • 举报
回复
引用 1 楼 fangmingshijie 的回复:
<bean id="whouseService" class="lux.service.impl.WhouseServiceImpl"> 给红色的类配置一个 <property name="sessionFactory"> <ref bean="sessionFactory" /> </property>
你是说在那个WhouseServiceImpl类里配置个sessionFactory还是注入一个sessionFactory whouseService注入的是whouse,whouse注入了sessionFactory
  • 打赏
  • 举报
回复
<bean id="whouseService" class="lux.service.impl.WhouseServiceImpl"> 给红色的类配置一个 <property name="sessionFactory"> <ref bean="sessionFactory" /> </property>

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧