package com.siqisoft.test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class A {
@Autowired
B b;
}
类B:
Java code
package com.siqisoft.test;
import org.springframework.stereotype.Component;
@Component
public class B {
public void BMethod(){};
}
B实现的接口
Java code
package com.siqisoft.test;
public abstract interface IB {
}
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
Error creating bean with name 'a':
又那里来的a列?
关于你的思考,回答如下: 用 @Autowired @Qualifier("b") //用B类型去注入. 请注意类名首字母小写 private BI b