public abstract class TestBean { private int a =0; }
public class TestBeanChild extends TestBean { int b = 1; public void execute() { System.out.println("132"); } }
<bean id="testBeanChild" class="com.yundaex.wms.config.TestBeanChild" />
@Autowired private TestBean a;
实际注入的是抽象类的子类
TestBeanChild,属性为a=0,b=1
时间: 2024-10-08 10:24:25