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

com.baidu.formula.discovery.configclient.FormulaDiscoveryClientConfigServiceBootstrapConfiguration Maven / Gradle / Ivy

package com.baidu.formula.discovery.configclient;

import com.baidu.formula.discovery.autoconfigure.FormulaDiscoveryClientConfiguration;
import com.baidu.formula.discovery.autoconfigure.FormulaDiscoveryProperties;
import com.baidu.formula.discovery.core.FormulaDiscoveryAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.cloud.config.client.ConfigServicePropertySourceLocator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * Helper for config client that wants to lookup the config server via discovery.
 *
 * @author Bowu Dong ([email protected])
 */
@ConditionalOnClass(ConfigServicePropertySourceLocator.class)
@ConditionalOnProperty("spring.cloud.config.discovery.enabled")
@Configuration
@Import({FormulaDiscoveryAutoConfiguration.class, FormulaDiscoveryClientConfiguration.class})
public class FormulaDiscoveryClientConfigServiceBootstrapConfiguration {

    @Bean
    public FormulaDiscoveryProperties formulaDiscoveryProperties(InetUtils inetUtils) {
        FormulaDiscoveryProperties properties = new FormulaDiscoveryProperties(inetUtils);
        // for bootstrap, lifecycle (and hence registration) is not needed, just discovery client
        properties.getLifecycle().setEnabled(false);
        return properties;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy