以下是配置文件:
<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注释了之后也没问题。
请大家帮忙解决。
------解决方案--------------------
<bean id="whouseService" class="lux.service.impl.WhouseServiceImpl">
给红色的类配置一个
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>