日期:2014-05-17  浏览次数:20725 次

关于ssh搭配框架问题
小弟、刚学ssh所以不是很理解。就按照老实讲的步骤来的。但是其实不是很理解写的那些配置文件都是什么意思。不废话。遇到个问题求助。。。。
我在spring配置文件applicationContext.xml中配置关联了两个实体类
<!-- 配置dao -->
<bean id="userdao" class="dao.impl.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="bookdao" class="dao.impl.BookDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<!-- 配置biz -->
<bean id="userbiz" class="biz.impl.UserBizImpl">
<property name="userDao" ref="userdao"></property>
</bean>
<bean id="bookbiz" class="biz.impl.BookBizImpl">
<property name="bookdao" ref="bookdao"></property>
</bean>

<!-- 配置action -->
<bean id="useraction" class="action.UserAction">
<property name="userBiz" ref="userbiz"></property>
</bean>
<bean id="bookaction" class="action.BookAction">
<property name="bookBiz" ref="bookbiz"></property>
</bean>
但是启动tomcat就报错。。。。郁闷。错误信息如下。。。
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookbiz' 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 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(Sta