|
|
@ -37,79 +37,80 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
public class ConfigHandlerConfiguration {
|
|
|
|
public class ConfigHandlerConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
private static final String NACOS_CONFIG_MANAGER_KEY = "com.alibaba.cloud.nacos.NacosConfigManager";
|
|
|
|
private static final String NACOS_CONFIG_MANAGER_KEY = "com.alibaba.cloud.nacos.NacosConfigManager";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String NACOS_DATA_ID_KEY = "nacos.data-id";
|
|
|
|
private static final String NACOS_DATA_ID_KEY = "nacos.data-id";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String APOLLO_NAMESPACE_KEY = "apollo.namespace";
|
|
|
|
private static final String APOLLO_NAMESPACE_KEY = "apollo.namespace";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String ZOOKEEPER_CONNECT_STR_KEY = "zookeeper.zk-connect-str";
|
|
|
|
private static final String ZOOKEEPER_CONNECT_STR_KEY = "zookeeper.zk-connect-str";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String ETCD = "etcd.endpoints";
|
|
|
|
private static final String ETCD = "etcd.endpoints";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String POLARIS = "config.serverConnector";
|
|
|
|
private static final String POLARIS = "config.serverConnector";
|
|
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ConditionalOnClass(ConfigService.class)
|
|
|
|
@ConditionalOnClass(ConfigService.class)
|
|
|
|
@ConditionalOnMissingClass(NACOS_CONFIG_MANAGER_KEY)
|
|
|
|
@ConditionalOnMissingClass(NACOS_CONFIG_MANAGER_KEY)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = NACOS_DATA_ID_KEY)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = NACOS_DATA_ID_KEY)
|
|
|
|
static class EmbeddedNacos {
|
|
|
|
static class EmbeddedNacos {
|
|
|
|
|
|
|
|
|
|
|
|
public final BootstrapConfigProperties bootstrapConfigProperties;
|
|
|
|
public final BootstrapConfigProperties bootstrapConfigProperties;
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public NacosRefresherHandler nacosRefresherHandler() {
|
|
|
|
public NacosRefresherHandler nacosRefresherHandler() {
|
|
|
|
return new NacosRefresherHandler(bootstrapConfigProperties);
|
|
|
|
return new NacosRefresherHandler(bootstrapConfigProperties);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(NacosConfigManager.class)
|
|
|
|
@ConditionalOnClass(NacosConfigManager.class)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = NACOS_DATA_ID_KEY)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = NACOS_DATA_ID_KEY)
|
|
|
|
static class EmbeddedNacosCloud {
|
|
|
|
static class EmbeddedNacosCloud {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public NacosCloudRefresherHandler nacosCloudRefresherHandler() {
|
|
|
|
public NacosCloudRefresherHandler nacosCloudRefresherHandler() {
|
|
|
|
return new NacosCloudRefresherHandler();
|
|
|
|
return new NacosCloudRefresherHandler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(com.ctrip.framework.apollo.ConfigService.class)
|
|
|
|
@ConditionalOnClass(com.ctrip.framework.apollo.ConfigService.class)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = APOLLO_NAMESPACE_KEY)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = APOLLO_NAMESPACE_KEY)
|
|
|
|
static class EmbeddedApollo {
|
|
|
|
static class EmbeddedApollo {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public ApolloRefresherHandler apolloRefresher() {
|
|
|
|
public ApolloRefresherHandler apolloRefresher() {
|
|
|
|
return new ApolloRefresherHandler();
|
|
|
|
return new ApolloRefresherHandler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(CuratorFramework.class)
|
|
|
|
@ConditionalOnClass(CuratorFramework.class)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = ZOOKEEPER_CONNECT_STR_KEY)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = ZOOKEEPER_CONNECT_STR_KEY)
|
|
|
|
static class EmbeddedZookeeper {
|
|
|
|
static class EmbeddedZookeeper {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public ZookeeperRefresherHandler zookeeperRefresher() {
|
|
|
|
public ZookeeperRefresherHandler zookeeperRefresher() {
|
|
|
|
return new ZookeeperRefresherHandler();
|
|
|
|
return new ZookeeperRefresherHandler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(Client.class)
|
|
|
|
@ConditionalOnClass(Client.class)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = ETCD)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = ETCD)
|
|
|
|
static class EmbeddedEtcd {
|
|
|
|
static class EmbeddedEtcd {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public EtcdRefresherHandler etcdRefresher() {
|
|
|
|
public EtcdRefresherHandler etcdRefresher() {
|
|
|
|
return new EtcdRefresherHandler();
|
|
|
|
return new EtcdRefresherHandler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(ConfigFileService.class)
|
|
|
|
@ConditionalOnClass(ConfigFileService.class)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = POLARIS)
|
|
|
|
@ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = POLARIS)
|
|
|
|
static class Polaris {
|
|
|
|
static class Polaris {
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
public PolarisRefresherHandler polarisRefresher(ConfigFileService configFileService) {
|
|
|
|
@Bean
|
|
|
|
return new PolarisRefresherHandler(configFileService);
|
|
|
|
public PolarisRefresherHandler polarisRefresher(ConfigFileService configFileService) {
|
|
|
|
}
|
|
|
|
return new PolarisRefresherHandler(configFileService);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|