org.zodiac.autoconfigure.apollo.ApolloClientAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.apollo;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
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.apollo.sdk.constants.ApolloSystemPropertiesConstants;
import org.zodiac.autoconfigure.apollo.condition.ConditionalOnApolloEnabled;
@SpringBootConfiguration
@ConditionalOnApolloEnabled
//@EnableConfigurationProperties(value = {ApolloClientProperties.class})
@AutoConfigureBefore(name = {"com.ctrip.framework.apollo.spring.boot.ApolloAutoConfiguration"})
@ConditionalOnClass(name = {"com.ctrip.framework.apollo.ConfigService", "com.ctrip.framework.apollo.Apollo"})
@ConditionalOnProperty(value = ApolloSystemPropertiesConstants.Zodiac.APOLLO_BOOTSTRAP_ENABLED, havingValue = "true")
public class ApolloClientAutoConfiguration {
public ApolloClientAutoConfiguration() {
super();
}
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(prefix = ApolloSystemPropertiesConstants.APOLLO_PREFIX, ignoreInvalidFields = true)
protected ApolloClientProperties ApolloClientProperties() {
return new ApolloClientProperties();
}
}