In configuration class AppWithInjectionConfig: @Autowired private MyBean myOtherBean;
@Bean public MyBean myBeanWithInjection(final MyBean myBean) { return new MyBeanWithInjectionImpl(myBean); }
Which bean will spring injects to myOtherBean and the myBean in the method parameter ?? there is no bean with name / ID myOtherBean nor myBean You will need to specify that name to one of the other defined beans.
Also, in fact most of these wont work as they are:
public MyBeanWithInjectionImpl(final MyBean myBean) { this.myBean = myBean; }....
Same problem here, there is no bean with that name.
Edit: nevermind, this is all included as one project. What i did find strange is that @ComponentScan also finds beans inside @Configuration classes without importing them?
In configuration class AppWithInjectionConfig:
@Autowired private MyBean myOtherBean;
@Bean
public MyBean myBeanWithInjection(final MyBean myBean) {
return new MyBeanWithInjectionImpl(myBean);
}
Which bean will spring injects to myOtherBean and the myBean in the method parameter ?? there is no bean with name / ID myOtherBean nor myBean
You will need to specify that name to one of the other defined beans.
Also, in fact most of these wont work as they are:
public MyBeanWithInjectionImpl(final MyBean myBean) {
this.myBean = myBean;
}....
Same problem here, there is no bean with that name.
Edit: nevermind, this is all included as one project. What i did find strange is that @ComponentScan also finds beans inside @Configuration classes without importing them?