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

实例化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;

你可能感兴趣的:(spring,xml,IOC)