ITeye博客

实例化Spring IoC容器的三种方法

zwh910621 · 2009-12-02 18:00 · spring · Markdown

实例化Spring IoC容器的三种方法
Resource resource=new FileSystemResource("beans.xml");
BeanFactory factory=new XmlBeanFactory(resource);

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

ApplicationContext context=new ClassPathXmlApplicationContext(
    new String[]{"applicationContext.xml","applicationContext-part2.xml"});
//BeanFactory factory=(BeanFactory)context;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。