We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Maxrunner • 4 years ago

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?

Anonymous • 5 years ago

花式扭BEAN, 勁!