主要跑这样的错误:org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is defined,
请大虾讲解讲解

解决方案 »

  1.   

    Looks up the SessionFactory in Spring's root web application context. Supports a "sessionFactoryBeanName" filter init-param in web.xml; the default bean name is "sessionFactory". Looks up the SessionFactory on each request, to avoid initialization order issues (when using ContextLoaderServlet, the root application context will get initialized after this filter). 在web.xml中配置OpenSessionInViewFilter时应该指定SessionFactory的名字,配置如下:
    <filter>         <filter-name>HibernateOpenSession</filter-name>          <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>        <init-param>          <param-name>sessionFactoryBeanName</param-name>         <param-value>mySessionFactory</param-value>     </init-param></filter>