“Error creating bean with name 'bookDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required”
解答:
<bean id="bookService" class="com.social.service.imp.BookService">
<property name="bookDao">
<ref bean="bookDao" />
</property>
</bean>
<bean id="bookDao" class="com.social.dao.imp.BookDao">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
被注入bookService的bookDao一定要配置sessionFactory。