I have the following java config class:
@Configuration
public class MyConfig {
@Autowired
private List<MyInterface> myInterfaces;
@Bean
public A a() {
return new A();
}
@PostConstruct
public void postConstruct() {
a().setProperty(myInterfaces);
}
}
Each MyInterface implementation will have a dependency on bean A, which I assume is where this circular dependency is coming from; my expectation, however, was as follows:
- This configuration class instantiates A and adds it to the application context
- The implementations of MyInterface are successfully injected with bean A
- The list of MyInterface implementations are injected into MyConfig
- The @PostConstruct executes, setting myInterfaces on bean A
Can anyone shed some light on which of my assumptions is incorrect?