时间+ 2015-07-30 08:39 采纳率: 80%
浏览 1410
已采纳

关于hibernatetemplate的问题

之前有练习过hibernatetemplate的相关用法,当时是在控制台练习的,用法是:
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
HibernateTemplate ht = (HibernateTemplate) ac.getBean("hibernateTemplate");
但是今天在读源码的时候发现在service里面对于hibernatetemplate的用法是使用注释
@Resource(name="hibernateTemplate")

    我想问一下后面这个只使用注释的这个方法,并没有之前装配applicationContext.xml的这个过程,我想问一下这个是怎么回事。。。是不是在其他地方装配了applicationContext.xml?
    补充一下。。。。。我的意思是为什么在使用注释@Resource的时候不需要使用ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");来创建一个spring容器呢??
  • 写回答

2条回答 默认 最新

  • 时间+ 2015-08-03 09:30
    关注

    我也不知道该怎么结束这个问答。。我已经知道答案了。。技术点在hibernate和spring整合。。。。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?