org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnSpringCloudBootstrapDisabled Maven / Gradle / Ivy
package org.zodiac.autoconfigure.bootstrap.condition;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.env.ConfigurableEnvironment;
import org.zodiac.commons.util.spring.Springs;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(ConditionalOnSpringCloudBootstrapDisabled.OnSpringCloudBootstrapDisabledCondition.class)
public @interface ConditionalOnSpringCloudBootstrapDisabled {
class OnSpringCloudBootstrapDisabledCondition extends AbstractOnBootstrapCondition {
OnSpringCloudBootstrapDisabledCondition() {
super(ConditionalOnSpringCloudBootstrapDisabled.class, false);
}
@Override
protected boolean matchCondition(ConfigurableEnvironment environment) {
boolean notCloudy = !Springs.isSpringCloud(environment);
return notCloudy;
}
}
// class OnBootstrapDisabledCondition extends NoneNestedConditions {
//
// OnBootstrapDisabledCondition() {
// super(ConfigurationPhase.REGISTER_BEAN);
// }
//
// @ConditionalOnClass(name = Springs.SPRING_CLOUD_MARKER_CLASS)
// static class OnBootstrapMarkerClassPresent {
//
// }
//
// /*from Spring Boot 2.4*/
// /*
// @ConditionalOnProperty(name = SystemPropertiesConstants.Spring.SPRING_CONFIG_USE_LEGACY_PROCESSING_PROPERTY)
// static class OnUseLegacyProcessingEnabled {
//
// }
// */
//
// @ConditionalOnProperty(name = SystemPropertiesConstants.Spring.SPRING_CLOUD_BOOTSTRAP_ENABLED)
// static class OnBootstrapEnabled {
//
// }
//
// }
}