hibernate注解导入包的问题

controller导入:import org.springframework.stereotype.Controller;

service导入:import org.springframework.stereotype.Service;

dao导入:import org.springframework.stereotype.Repository;

entity导入:import javax.persistence.Entity;

compo导入:import org.springframework.stereotype.Component;

:Caused by: org.springframework.beans.factory.BeanCreationException: 



Error creating bean with name 'userDaoImpl' defined in file [D:\apache-


tomcat-7.0.79\webapps\doitdoit\WEB-INF\classes\com\nsfw\user\dao\impl


\UserDaoImpl.class]: Invocation of init method failed; nested exception 


is java.lang.IllegalArgumentException: 'sessionFactory' or 


'hibernateTemplate' is required
at 


org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact


ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
at 


org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact


ory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at 


org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact


ory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory


$1.getObject(AbstractBeanFactory.java:296)
at 


org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.ge


tSingleton(DefaultSingletonBeanRegistry.java:223)
at 


org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean


(AbstractBeanFactory.java:293)
at 


org.springframework.beans.factory.support.AbstractBeanFactory.getBean


(AbstractBeanFactory.java:194)
at 


org.springframework.beans.factory.support.DefaultListableBeanFactory.find


AutowireCandidates(DefaultListableBeanFactory.java:912)
at 


org.springframework.beans.factory.support.DefaultListableBeanFactory.doRe


solveDependency(DefaultListableBeanFactory.java:855)
at 


org.springframework.beans.factory.support.DefaultListableBeanFactory.reso


lveDependency(DefaultListableBeanFactory.java:770)
at 


org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostP


rocessor$AutowiredFieldElement.inject


(AutowiredAnnotationBeanPostProcessor.java:489)
... 42 more
Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 


'hibernateTemplate' is required
at 


org.springframework.orm.hibernate3.support.HibernateDaoSupport.checkDaoCo


nfig(HibernateDaoSupport.java:118)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet


(DaoSupport.java:44)
at 


org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact


ory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
at 


org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact


ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
... 52 more
还有可能是导入包导入错了
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值