org.zodiac.autoconfigure.nacos.confcenter.rule.NacosRuleBootstrapConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.nacos.confcenter.rule;
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.springframework.core.Ordered;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnRuleEnabled;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnSpringCloudBootstrapDisabled;
import org.zodiac.autoconfigure.nacos.condition.ConditionalOnNacosConfCenterEnabled;
import org.zodiac.autoconfigure.nacos.condition.ConditionalOnNacosRuleEnabled;
import org.zodiac.core.bootstrap.rule.AppRuleProviderCustomizer;
@SpringBootConfiguration
@ConditionalOnRuleEnabled
@ConditionalOnNacosRuleEnabled
@ConditionalOnNacosConfCenterEnabled
@ConditionalOnSpringCloudBootstrapDisabled
@ConditionalOnClass(value = {com.alibaba.nacos.api.NacosFactory.class, org.zodiac.nacos.base.NacosAppInstance.class, org.zodiac.nacos.client.context.NacosClientContext.class})
public class NacosRuleBootstrapConfiguration implements Ordered {
public NacosRuleBootstrapConfiguration() {
}
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(value = org.zodiac.nacos.base.constants.NacosSystemPropertiesConstants.NACOS_RULE_PREFIX)
protected NacosRuleProperties nacosRuleProperties() {
return new NacosRuleProperties();
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.nacos.client.confcenter.config.NacosRuleConfigurer nacosRuleConfigurer() {
return new org.zodiac.nacos.client.confcenter.config.NacosRuleConfigurer();
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.nacos.client.confcenter.rule.NacosAppRuleProvider nacosAppRuleProvider(
org.zodiac.nacos.client.confcenter.config.NacosRuleConfigurer nacosRuleConfigurer,
NacosRuleProperties nacosRuleProperties, com.alibaba.nacos.api.config.ConfigService configService) throws com.alibaba.nacos.api.exception.NacosException {
return nacosRuleConfigurer.nacosAppRuleProvider(nacosRuleProperties, configService);
}
@Bean
@ConditionalOnMissingBean
protected AppRuleProviderCustomizer nacosRuleProviderCustomizer(
org.zodiac.nacos.client.confcenter.config.NacosRuleConfigurer nacosRuleConfigurer,
org.zodiac.nacos.client.confcenter.rule.NacosAppRuleProvider nacosAppRuleProvider) {
return nacosRuleConfigurer.nacosRuleProviderCustomizer(nacosAppRuleProvider);
}
public int getOrder() {
return 0;
}
}