there is no bean Father, but there is Bean Son, is this a bug?

ConfigurableApplicationContext context = SpringApplication.run(SpringBeanApplication.class, args);
Son son = context.getBean(Son.class);
son.hello();
Father bean = context.getBean(Father.class);
bean.hello();


@Service
@ConditionalOnMissingBean(Enemy.class)
public class Father {
    public void hello() {
        System.out.println("father hello");
    }
}

@Service
public class Enemy {

}

@Service
@ConditionalOnBean(Father.class)
public class Son {
    public void hello() {
        System.out.println("son hello");
    }
}

Comment From: snicoll

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

As indicated in the Javadoc of @ConditionalOnMissingBean, such condition relies on the order in which the various components have been defined and you should only use those on auto-configuration.