com.azure.spring.cloud.appconfiguration.config.AppConfigurationAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-cloud-azure-appconfiguration-config Show documentation
Show all versions of spring-cloud-azure-appconfiguration-config Show documentation
Integration of Spring Cloud Config and Azure App Configuration Service
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.spring.cloud.appconfiguration.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.endpoint.RefreshEndpoint;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import com.azure.spring.cloud.appconfiguration.config.implementation.AppConfigurationPullRefresh;
import com.azure.spring.cloud.appconfiguration.config.implementation.AppConfigurationRefreshUtil;
import com.azure.spring.cloud.appconfiguration.config.implementation.AppConfigurationReplicaClientFactory;
import com.azure.spring.cloud.appconfiguration.config.implementation.autofailover.ReplicaLookUp;
import com.azure.spring.cloud.appconfiguration.config.implementation.properties.AppConfigurationProperties;
import com.azure.spring.cloud.appconfiguration.config.implementation.properties.AppConfigurationProviderProperties;
/**
* Setup AppConfigurationRefresh when spring.cloud.azure.appconfiguration.enabled is enabled.
*/
@Configuration
@EnableAsync
@ConditionalOnProperty(prefix = AppConfigurationProperties.CONFIG_PREFIX, name = "enabled", matchIfMissing = true)
public class AppConfigurationAutoConfiguration {
/**
* Creates an instance of {@link AppConfigurationAutoConfiguration}
*/
public AppConfigurationAutoConfiguration() {
}
/**
* Auto Watch
*/
@Configuration
@ConditionalOnClass(RefreshEndpoint.class)
public static class AppConfigurationWatchAutoConfiguration {
/**
* Creates an instance of {@link AppConfigurationWatchAutoConfiguration}
*/
public AppConfigurationWatchAutoConfiguration() {
}
@Bean
@ConditionalOnMissingBean
AppConfigurationRefresh appConfigurationRefresh(AppConfigurationProperties properties,
AppConfigurationProviderProperties appProperties, AppConfigurationReplicaClientFactory clientFactory, ReplicaLookUp replicaLookUp) {
return new AppConfigurationPullRefresh(clientFactory, properties.getRefreshInterval(),
appProperties.getDefaultMinBackoff(), replicaLookUp, new AppConfigurationRefreshUtil());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy