为什么我不需要在Spring配置类中@Bean方法上进行@Autowired?
2022-09-02 01:16:12
为什么这样做:
@Configuration
public class MyConfig {
@Bean
public A getA() {
return new A();
}
@Bean // <-- Shouldn't I need @Autowired here?
public B getB(A a) {
return new B(a);
}
}
谢谢!