spring 中加載xml配置文件的方式
XmlBeanFactory
ClassPathXmlApplicationContext
FileSystemXmlApplicationContext
XmlWebApplicationContext
一
Resource resource = new ClassPathResource(
BeanFactory factory = new XmlBeanFactory(resource)
二
ApplicationContext factory=new ClassPathXmlApplicationContext(
ApplicationContext factory=new ClassPathXmlApplicationContext(
ApplicationContext factory=new ClassPathXmlApplicationContext(
ApplicationContext factory=new ClassPathXmlApplicationContext(
三 : 用文件系統的路徑
ApplicationContext factory=new FileSystemXmlApplicationContext(
//使用了 classpath: 前綴
ApplicationContext factory=new FileSystemXmlApplicationContext(
ApplicationContext factory=new FileSystemXmlApplicationContext(
ApplicationContext factory=new FileSystemXmlApplicationContext(
四
ServletContext servletContext = request
ApplicationContext ctx = WebApplicationContextUtils
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28211.html