快递单号查询
走到今天,我才发现原来技术之路确实难走!需要忍受痛苦和煎熬,需要放弃很多东西
  

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。
     

   解决方法:

  @Resource
   public void setSessionFactory0(SessionFactory sessionFactory){  
      super.setSessionFactory(sessionFactory);  
   }
 
posted @ 2016-06-18 05:52  微冷的雨  阅读(6571)  评论(0编辑  收藏  举报