一、通过set方法实例化bean(set注入、使用property标签赋值)
bean:
package scope;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class bean2 {
private Integer id;
private String name;
private String[] fatherAndMother;
private double source;
private Map<String,String> shu;
private List<String> home;
private Set<String> xueLi;
private bean1 bean;
public bean2() {
}
public bean2(Integer id, String name, String[] fatherAndMother, double source, Map<String, String> shu, List<String> home, Set<String> xueLi, bean1 bean) {
this.id = id;
this.name = name;
this.fatherAndMother = fatherAndMother;
this.source = source;
this.shu = shu;
this.home = home;
this.xueLi = xueLi;
this.bean = bean;
}
@Override
public String toString() {
return "bean2{" +
"id=" + id +
", name='" + name + '\'' +
",\n fatherAndMother=" + Arrays.toString(fatherAndMother) +
",\n source=" + source +
",\n shu=" + shu +
",\n home=" + home +
",\n xueLi=" + xueLi +