(一)构造方法的属性注入
1.Student.java
package entity; public class Student { private String name; private String age; public Student(String name, String age) { this.name = name; this.age = age; } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", age='" + age + '\'' + '}'; } }