//讀取配置文件
Resource resource = new ClassPathResource(
//創建spring容器
BeanFactory beanFactory = new XmlBeanFactory(resource);
等價於
ApplicationContext ac = new ClassPathXmlApplicationContext(
//絕對路徑讀取配置文件
Resource resource = new FileSystemResource(
//創建容器
BeanFactory beanFactory = new XmlBeanFactory(resource);
等價於
ApplicationContext ac = new FileSystemXmlApplicationContext(
ClassPathXmlApplicationContext(C)和FileSystemXmlApplicationContext(F)
(
F
C
(
F支持ClassPath搜索器
classpath:applicationContext
(
FileSystemXmlApplicationContext支持國際化
實際開發
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28893.html