之前有练习过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容器呢??