factory工厂的创建
package test; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import entity.Student; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub BeanFactory factory = new ClassPathXmlApplicationContext("classpath:beans.xml"); Student s =factory.getBean("student",Student.class); s.showInfo(); System.out.println(s); Student s2 =factory.getBean("student",Student.class); s2.showInfo(); System.out.println(s2); } }