I am trying to implement Spring Condition org.springframework.context.annotation.Condition
as follows:
public class APIScanningDecisionMaker impl
If you add @Conditional
to config class then APIScanningDecisionMaker
should implement ConfigurationCondition
. And don't forget to add @PropertySource
to config class.
import org.springframework.context.annotation.ConfigurationCondition;
public class APIScanningDecisionMaker implement ConfigurationCondition {
@Override
public ConfigurationPhase getConfigurationPhase() {
return ConfigurationPhase.REGISTER_BEAN;
}
}
Properties will have been loaded in ConfigurationPhase.REGISTER_BEAN
phase.
If you use @Conditional
for methods then you could implement Condition
.