java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

嚴重: 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 'CourseDAO' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.orm.hibernate3.support.HibernateDaoSupport.checkDaoConfig(HibernateDaoSupport.java:118)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 26 more


    因爲我使用的是spring的annotation注入,HibernateDaoSupport不能注入sessionFactiry和hibernateTemplemet。
     

   解決方法:java

  @Resource    public void setSessionFactory0(SessionFactory sessionFactory){         super.setSessionFactory(sessionFactory);      }
相關文章
相關標籤/搜索