码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-06-18 06:47:36      阅读:430      评论:0      收藏:0      [点我收藏+]

标签:

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);  
   }
 

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

标签:

原文地址:http://www.cnblogs.com/weilengdeyu/p/5595610.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!