- 创建类型:Person.java
public class Person {}
- 配置文件的配置:
- 通过工厂类,获得对象
@Test
public void test() {
// 1、获取spring的工厂
ApplicationContext ctx = new ClassPathXmlApplicationContext("/applicationContext.xml");
// 2、通过工厂类获得对象
Person person = (Person)ctx.getBean("person");
System.out.println(person);
}



