All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.datasource.jdbc.condition.MasterSlaveRuleCondition Maven / Gradle / Ivy

package org.zodiac.autoconfigure.datasource.jdbc.condition;

import org.apache.shardingsphere.spring.boot.util.PropertyUtil;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.zodiac.commons.constants.SystemPropertiesConstants;

public final class MasterSlaveRuleCondition extends SpringBootCondition {

    @Override
    public ConditionOutcome getMatchOutcome(final ConditionContext conditionContext,
        final AnnotatedTypeMetadata annotatedTypeMetadata) {
        return PropertyUtil.containPropertyPrefix(conditionContext.getEnvironment(),
            SystemPropertiesConstants.Zodiac.SPRING_DATASOURCE_JDBC_RULES_MASTER_SLAVE_PREFIX) ? ConditionOutcome.match()
                : ConditionOutcome.noMatch("Can't find ShardingSphere master-slave rule configuration in environment.");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy