I have configured my Spring application as below:
Class A{
@Resource
private B objB;
@Resource
private C objC;
}
Class B{}
Class C{}
@Configuration
Class SpringConfigs{
@Bean
public A objA(){
return new A();
}
@Bean
public B objB(){
return new B();
}
@Bean
public C objC(){
return new C();
}
}
I use component-scan to pick the @Configurations. My question is will Spring inject the Beans for B & C while creating the bean for A. I use @Resource inside the Class A but use new operator to create the Bean, so will Spring recognize the annotations inside Class A and inject them? Thanks.