xml方式注册Bean的实现方式
1.无参构造函数
public abstract class Animal {
public abstract String get();
}
@Getter
@Setter
public class Dog extends Animal {
private String name;
private Integer age;
private List<String> hobby;
public Dog() {
}
public Dog(String name, Integer age) {
this.name = name;
this.age = age;
}
@Override
public String get() {
return this.toString();
}
@Override
public String toString() {
return "Dog{" +
"name='" + name + '\'' +
", age='" + age + '\'' +
", hobby=" + hobby +
'}';
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=