cannnot autowire beans registered by registerBeanDefinition()
I have an ApplicationContextAware factory bean that generates proxy beans of a given list of interfaces in the post-construct method:
Code:
@PostConstruct
public void generateProxy() {
...
applicationContext.getBeanFactory().registerBeanDefinition("myProxy", ...);
}
The generated proxy works as expected when it is injected into other beans explicitly:
Code:
<bean ... depends-on="myFactory">
<property name="myIntrfc" ref="myProxy"/>
<bean/>
However, if the property myIntrfc is set to autowired, Spring complains "no matching bean of type MyIntrfc". I guess it is due to the order: autowiring is done before post-construct of the depends-on bean. Am I correct and any way to change the order?