第一种方式:ClassPathResource cpr = new ClassPathResource("applicationContext.xml");
Person chinese = (Person) factory.getBean("chinese");//参数为配置文件中的id值
System.out.println(chinese.sayGoodBye("张三"));第二中方式:(多个配置文件,用数组)ApplicationContext ac = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml",
"applicationContext2.xml"});
第三种方式:(java的文件系统)ApplicationContext ac = new FileSystemXmlApplicationContext("src/applicationContext.xml");
Person chinese = (Person) ac.getBean("chinese");//参数为配置文件中的id值