您的位置:首页 > 编程语言 > Java开发

Spring Ioc 容器实例化容器

2007-11-29 15:48 375 查看
Spring Ioc 容器实例化容器如:
1).Resource resource = new FileSystemResource("beans.xml");
BeanFactory factory = new XmlBeanFactory(resource);

2).ClassPathResource resource = new ClassPathResource("beans.xml");
BeanFactory factory = new XmlBeanFactory(resource);

3).ApplicationContext context = new ClassPathXmlApplicationContext(
new String[] {"applicationContext.xml","applicationContext-part2.xml"});
BeanFactory factory = (BeanFactory)context;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: