Spring工厂类
/** * 读取磁盘上的配置文件 */ @Test public void demo3(){ ApplicationContext applicationContext = new FileSystemXmlApplicationContext("c:\\applicationContext.xml"); UserService userService = (UserService) applicationContext.getBean("userService"); userService.sayHello(); } 原始的工厂类BeanFactory 现在的工厂类ApplicationContext 来源: https://www.cnblogs.com/yangHS/p/11373813.html