1、通过FileSystemApplicationContext来获取(不常用,因为要spring配置文件的绝对路径)

2、通过ClassPathXmlApplicationContext来获取(常用)

3、通过XmlBeanFactory来获取