Как бы вы получили имя компонента, помеченного @Conditional(MyCondition.class)
, из оценки самого условия?
static class MyCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
if (shouldRegister) {
return true;
} else {
System.out.println("Bean " + metadata.Can_I_Get_A_Reference_To_The_Bean_NameHere() + " will not be created.");
return false;
}
}
}