I tried to copy existing applications @ConditionalOnMissingBeanfrom the Internet and noticed that they all refer to the method @Bean.
In fact, when I added this code to AUsage:
public class AUsage {
@Autowired
private A a;
@Bean
@ConditionalOnMissingBean
public A createA() {
return new AImpl();
}
}
and removed annotations from AImpl:
public class AImpl implements A {...}
everything works as expected.
, .