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

org.zodiac.autoconfigure.sentinel.datasource.SentinelApolloDataSourceAutoConfiguration Maven / Gradle / Ivy

package org.zodiac.autoconfigure.sentinel.datasource;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnSpringCloudBootstrapDisabled;
import org.zodiac.autoconfigure.sentinel.condition.ConditionalOnSentinelConfigEnabled;

@SpringBootConfiguration
@ConditionalOnSentinelConfigEnabled
@ConditionalOnSpringCloudBootstrapDisabled
@ConditionalOnClass(value = {com.alibaba.csp.sentinel.Env.class, com.alibaba.csp.sentinel.datasource.ReadableDataSource.class, com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource.class, org.zodiac.sentinel.base.model.SentinelRule.class, org.zodiac.sentinel.apollo.config.ApolloDataSourceListInfo.class})
public class SentinelApolloDataSourceAutoConfiguration {

    public SentinelApolloDataSourceAutoConfiguration() {
        super();
    }

    @Bean
    @ConditionalOnMissingBean
    @ConfigurationProperties(prefix = org.zodiac.sentinel.apollo.constants.SentinelApolloSystemPropertiesConstants.Zodiac.SENTINEL_DATASOURCE_APOLLO_PREFIX)
    protected ApolloDataSourceListProperties apolloDataSourceListProperties() {
        return new ApolloDataSourceListProperties();
    }

    @Bean
    @ConditionalOnMissingBean
    protected org.zodiac.sentinel.apollo.config.configurer.SentinelApolloDataSourceConfigurer sentinelApolloDataSourceConfigurer(
        ApolloDataSourceListProperties dataSourceListProperties) {
        return new org.zodiac.sentinel.apollo.config.configurer.SentinelApolloDataSourceConfigurer()
            .setId(dataSourceListProperties.getId())
            .setList(dataSourceListProperties.getList())
            .setOrder(dataSourceListProperties.getOrder());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy