1.创建ApplicationContext对象:
ApplicationContext context = new FileSystemXmlApplicationContext("D:/workspace/test/resources/applicationContext-resource.xml");
2.调用getBean方法(注意参数以xml配置中的bean的名字匹配):
trDAO = (ITestResultDAO) context.getBean("trDAO");本文共 296 字,大约阅读时间需要 1 分钟。
1.创建ApplicationContext对象:
ApplicationContext context = new FileSystemXmlApplicationContext("D:/workspace/test/resources/applicationContext-resource.xml");
2.调用getBean方法(注意参数以xml配置中的bean的名字匹配):
trDAO = (ITestResultDAO) context.getBean("trDAO");转载于:https://www.cnblogs.com/nickhan/p/4221835.html