如果文件在classpath下:
ApplicationContext ctx= new ClassPathXmlApplicationContext(new String[]{“beans.xml”,”application.xml”});
BeanFactory factory =ctx;
如果文件不在classpath下:
ApplicationContext ctx = new FileSystemXmlApplicationContext(new String[]{"file:D:/workspace_dna2/GdnaDataWebService/src/main/webapp/WEB-NF/applicationContext.xml", "file:D:/workspace_dna2/GdnaDataWebService/src/main/webapp/WEB-INF/xfire-servlet.xml"});