UserDaoImpl中的代码,实现对name和age的注入
private String name;
private int age;
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
applicationContext.xml中的配置
构造器注入将applicationContext.xml中的配置的property换成 constructor-arg,name属性是构造器的形参
浙公网安备 33010602011771号