================ 第一个Spring程序 ================ 1 定义一个类 /src/main/java/cn/tedu/hellospring/Student.java: public class Student { } 2 通过配置文件告诉工厂有这么个类 /src/main/resources/applicationContext.xml: ... ... 3 通过工厂获得这个类的对象 /src/test/java/cn/tedu/hellospring/StudentTest.java: class StudentTest { @org.junit.jupiter.api.Test void test1() { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml"); Student student = (Student) applicationContext.getBean("student"); System.out.println(student); } } cn.tedu.hellospring.Student@47eaca72 例程:HelloSpring