手动从Spring中获取指定对象
1.创建ApplicationContext对象:
ApplicationContext context = new FileSystemXmlApplicationContext("D:/workspace/test/resources/applicationContext-resource.xml");
2.调用getBean方法(注意参数以xml配置中的bean的名字匹配):
trDAO = (ITestResultDAO) context.getBean("trDAO");