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

org.zodiac.autoconfigure.nacos.NacosBaseBootstrapConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.nacos;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.application.ApplicationInfoProperties;
import org.zodiac.autoconfigure.nacos.condition.ConditionalOnNacosConfCenterEnabled;
import org.zodiac.autoconfigure.nacos.condition.ConditionalOnNacosDiscoveryEnabled;

@SpringBootConfiguration
@ConditionalOnClass(value = {com.alibaba.nacos.api.NacosFactory.class, org.zodiac.nacos.base.NacosAppInstance.class})
public class NacosBaseBootstrapConfiguration {

    public NacosBaseBootstrapConfiguration() {
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnNacosConfCenterEnabled
    @ConfigurationProperties(prefix = org.zodiac.nacos.base.constants.NacosSystemPropertiesConstants.NACOS_CONFIG_PREFIX, ignoreInvalidFields = true)
    protected org.zodiac.nacos.client.confcenter.autoconfigure.NacosConfCenterProperties nacosConfCenterProperties() {
        return new org.zodiac.nacos.client.confcenter.autoconfigure.NacosConfCenterProperties();
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnNacosDiscoveryEnabled
    @ConditionalOnProperty(name = org.zodiac.nacos.base.constants.NacosSystemPropertiesConstants.NACOS_DISCOVERY_ENABLED, havingValue = "true")
    protected NacosNamingProperties nacosNamingProperties(ApplicationInfoProperties applicationInfoProperties) {
        NacosNamingProperties properties = new NacosNamingProperties(applicationInfoProperties.getName());
        return properties;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy