I want a spring bean to be instanciated after another bean. So I simply use the @DependsOn
annotation.
The thing is : this other bean is a
You can use custom condition class:
public class BeanPresennceCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
FirstBean firstBean = null;
try {
firstBean = (FirstBean)context.getBeanFactory().getBean("firstBean");
}catch(NoSuchBeanDefinitionException ex) {
}
return firstBean != null;
}
}