Spring Cloud Config Client工作原理

Nacos架构篇 - 打通Nacos配置中心原理的任督二脉 本文解析nacos配置中心的原理。 阅读详情

说明:本版本的Spring Cloud Config Client的版本为3.0.5

Spring Cloud Config Client实现的依赖关系图大致如下:

 

接下来我们一同探讨Spring Cloud Config Client的实现原理

  1. ConfigServiceBootstrapConfiguration类的自动装配

在spring-cloud-config-client-3.0.5.jar包中的META-INF的spring.factories文件中包含

# Bootstrap components
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
org.springframework.cloud.config.client.ConfigServiceBootstrapConfiguration,\
org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration

        所以ConfigServiceBootstrapConfiguration类会被Spring Boot默认进行自动加载装配的,在该类中我们看到了按条件加载装配的ConfigServicePropertySourceLocator,代码如下:

@Bean
@ConditionalOnMissingBean(ConfigServicePropertySourceLocator.class)
@ConditionalOnProperty(name = ConfigClientProperties.PREFIX + ".enabled", matchIfMissing = true)
public ConfigServicePropertySourceLocator configServicePropertySource(ConfigClientProperties properties) {
   return new ConfigServicePropertySourceLocator(properties);
}

        当配置文件中配置了spring.cloud.config.enabled为true,或缺失时都会自动装配ConfigServicePropertySourceLocator。从远程配置中心获取配置信息的功能就是在ConfigServicePropertySourceLocator类中实现的。

2. ConfigServicePropertySourceLocator类的功能

ConfigServicePropertySourceLocator类实现了PropertySourceLocator接口,

PropertySourceLocator接口的定义如下:

public interface PropertySourceLocator {

   /**
    * @param environment The current Environment.
    * @return A PropertySource, or null if there is none.
    * @throws IllegalStateException if there is a fail-fast condition.
    */
   PropertySource<?> locate(Environment environment);

   default Collection<PropertySource<?>> locateCollection(Environment environment) {
      return locateCollection(this, environment);
   }

   static Collection<PropertySource<?>> locateCollection(PropertySourceLocator locator, Environment environment) {
      PropertySource<?> propertySource = locator.locate(environment);
      if (propertySource == null) {
         return Collections.emptyList();
      }
      if (CompositePropertySource.class.isInstance(propertySource)) {
         Collection<PropertySource<?>> sources = ((CompositePropertySource) propertySource).getPropertySources();
         List<PropertySource<?>> filteredSources = new ArrayList<>();
         for (PropertySource<?> p : sources) {
            if (p != null) {
               filteredSources.add(p);
            }
         }
         return filteredSources;
      }
      else {
         return Arrays.asList(propertySource);
      }
   }

}

locate抽象方法用于实现从远程配置中心获取指定的配置信息,Spring Cloud Config中把配置信息抽象为应用(application)、环境(profile)和版本(label)这三个维度进行管理,通过这三个维度,我们就可以确定唯一的一份配置数据。

ConfigServicePropertySourceLocator类中locate方法的实现

public org.springframework.core.env.PropertySource<?> locate(org.springframework.core.env.Environment environment) {
   ConfigClientProperties properties = this.defaultProperties.override(environment);
   CompositePropertySource composite = new OriginTrackedCompositePropertySource("configService");
   ConfigClientRequestTemplateFactory requestTemplateFactory = new ConfigClientRequestTemplateFactory(logger,
         properties);

   Exception error = null;
   String errorBody = null;
   try {
      String[] labels = new String[] { "" };
      if (StringUtils.hasText(properties.getLabel())) {
         labels = StringUtils.commaDelimitedListToStringArray(properties.getLabel());
      }
      String state = ConfigClientStateHolder.getState();
      // Try all the labels until one works
      for (String label : labels) {
         Environment result = getRemoteEnvironment(requestTemplateFactory, label.trim(), state);
         if (result != null) {
            log(result);

            // result.getPropertySources() can be null if using xml
            if (result.getPropertySources() != null) {
               for (PropertySource source : result.getPropertySources()) {
                  @SuppressWarnings("unchecked")
                  Map<String, Object> map = translateOrigins(source.getName(),
                        (Map<String, Object>) source.getSource());
                  composite.addPropertySource(new OriginTrackedMapPropertySource(source.getName(), map));
               }
            }

            HashMap<String, Object> map = new HashMap<>();
            if (StringUtils.hasText(result.getState())) {
               putValue(map, "config.client.state", result.getState());
            }
            if (StringUtils.hasText(result.getVersion())) {
               putValue(map, "config.client.version", result.getVersion());
            }
            // the existence of this property source confirms a successful
            // response from config server
            composite.addFirstPropertySource(new MapPropertySource("configClient", map));
            return composite;
         }
      }
      errorBody = String.format("None of labels %s found", Arrays.toString(labels));
   }
   catch (HttpServerErrorException e) {
      error = e;
      if (MediaType.APPLICATION_JSON.includes(e.getResponseHeaders().getContentType())) {
         errorBody = e.getResponseBodyAsString();
      }
   }
   catch (Exception e) {
      error = e;
   }
   if (properties.isFailFast()) {
      throw new IllegalStateException("Could not locate PropertySource and the fail fast property is set, failing"
            + (errorBody == null ? "" : ": " + errorBody), error);
   }
   logger.warn("Could not locate PropertySource: " + (error != null ? error.getMessage() : errorBody));
   return null;

}

该方法的核心是从getRemoteEnvironment方法获取远程配置中心的指定配置内容。

private Environment getRemoteEnvironment(ConfigClientRequestTemplateFactory requestTemplateFactory, String label,
			String state) {
		//获取RestTemplate对象,该对象用于调用Restful接口
		RestTemplate restTemplate = this.restTemplate == null ? requestTemplateFactory.create() : this.restTemplate;
		//获取配置属性
		ConfigClientProperties properties = requestTemplateFactory.getProperties();
		String path = "/{name}/{profile}";
		String name = properties.getName();  //配置文件中的spring.application.name
		String profile = properties.getProfile();  //默认是default
		String token = properties.getToken();
		int noOfUrls = properties.getUri().length;  //获取配置的uri的数量
		if (noOfUrls > 1) {
			logger.info("Multiple Config Server Urls found listed.");
		}
		//构建请求路径
		Object[] args = new String[] { name, profile };
		if (StringUtils.hasText(label)) {
			// workaround for Spring MVC matching / in paths
			label = Environment.denormalize(label);
			args = new String[] { name, profile, label };
			path = path + "/{label}";
		}
		ResponseEntity<Environment> response = null;
		List<MediaType> acceptHeader = Collections.singletonList(MediaType.parseMediaType(properties.getMediaType()));

		for (int i = 0; i < noOfUrls; i++) {
			Credentials credentials = properties.getCredentials(i);
			String uri = credentials.getUri();
			String username = credentials.getUsername();
			String password = credentials.getPassword();

			logger.info("Fetching config from server at : " + uri);

			try {
				HttpHeaders headers = new HttpHeaders();
				headers.setAccept(acceptHeader);
				requestTemplateFactory.addAuthorizationToken(headers, username, password);
				if (StringUtils.hasText(token)) {
					headers.add(TOKEN_HEADER, token);
				}
				if (StringUtils.hasText(state) && properties.isSendState()) {
					headers.add(STATE_HEADER, state);
				}

				final HttpEntity<Void> entity = new HttpEntity<>((Void) null, headers);
				//远程调用获取对应的配置信息
				response = restTemplate.exchange(uri + path, HttpMethod.GET, entity, Environment.class, args);
			}
			catch (HttpClientErrorException e) {
				if (e.getStatusCode() != HttpStatus.NOT_FOUND) {
					throw e;
				}
			}
			catch (ResourceAccessException e) {
				logger.info("Connect Timeout Exception on Url - " + uri + ". Will be trying the next url if available");
				if (i == noOfUrls - 1) {
					throw e;
				}
				else {
					continue;
				}
			}

			if (response == null || response.getStatusCode() != HttpStatus.OK) {
				return null;
			}

			Environment result = response.getBody();
			return result;
		}

		return null;
	}

上述代码的主要流程就是获取访问配置服务器所需的 application、profile、label 等参数,然后利用 RestTemplate 工具类执行 HTTP 请求。客户端从这个请求所返回的 Environment 对象中获得所需要的各项配置信息。

3.  PropertySourceBootstrapConfiguration类的自动装配

@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(PropertySourceBootstrapProperties.class)
public class PropertySourceBootstrapConfiguration
      implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered 

ropertySourceBootstrapProperties类的定义

@ConfigurationProperties("spring.cloud.config")
public class PropertySourceBootstrapProperties

我们从以上类的定义中我们看到当引入spring.cloud.config配置就会自动装配PropertySourceBootstrapConfiguration类,并且该类实现了ApplicationContextInitializer接口。

PropertySourceBootstrapConfiguration加载时会自动获取Spring 容器中的PropertySourceLocator Bean。

@Autowired(required = false)
private List<PropertySourceLocator> propertySourceLocators = new ArrayList<>();

PropertySourceBootstrapConfiguration 实现了 ApplicationContextInitializer 接口中的 initialize 方法,而所有的 ApplicationContextInitializer 都会在 Spring Boot 应用程序启动时进行加载。这样,当类路径中引入了 Spring Cloud Config 之后,一个 ConfigServicePropertySourceLocator 实例就会被构建并保存在 PropertySourceBootstrapConfiguration 的 propertySources中。然后,我们会遍历所有 propertySourceLocators 的 locate 方法,从而完成对远程服务配置信息的读取。

initialize方法定义如下:

@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
   List<PropertySource<?>> composite = new ArrayList<>();
   AnnotationAwareOrderComparator.sort(this.propertySourceLocators);
   boolean empty = true;
   ConfigurableEnvironment environment = applicationContext.getEnvironment();
   for (PropertySourceLocator locator : this.propertySourceLocators) {
      Collection<PropertySource<?>> source = locator.locateCollection(environment);
      if (source == null || source.size() == 0) {
         continue;
      }
      List<PropertySource<?>> sourceList = new ArrayList<>();
      for (PropertySource<?> p : source) {
         if (p instanceof EnumerablePropertySource) {
            EnumerablePropertySource<?> enumerable = (EnumerablePropertySource<?>) p;
            sourceList.add(new BootstrapPropertySource<>(enumerable));
         }
         else {
            sourceList.add(new SimpleBootstrapPropertySource(p));
         }
      }
      logger.info("Located property source: " + sourceList);
      composite.addAll(sourceList);
      empty = false;
   }
   if (!empty) {
      MutablePropertySources propertySources = environment.getPropertySources();
      String logConfig = environment.resolvePlaceholders("${logging.config:}");
      LogFile logFile = LogFile.get(environment);
      for (PropertySource<?> p : environment.getPropertySources()) {
         if (p.getName().startsWith(BOOTSTRAP_PROPERTY_SOURCE_NAME)) {
            propertySources.remove(p.getName());
         }
      }
      insertPropertySources(propertySources, composite);
      reinitializeLoggingSystem(environment, logConfig, logFile);
      setLogLevels(applicationContext, environment);
      handleIncludedProfiles(environment);
   }
}

        看到调用locateCollection方法获取远程配置中心数据,如果获取的数据不为空,则会调用insertPropertySources方法来注入获取到的配置信息。

Nacos系列(三):nacos实现统一配置管理 1、配置中心 1.1、传统配置方式的局限 无法实现配置的动态更新,修改配置文件,需要重启服务 配置集中式管理,服务节点一多,修改配置文件,需要同时修改多个文件 配置内容的安全性和权限 不用配置环境下配置管理,不方便维护 1.2、nacos配置中心简介 [1] nacos主要有confug service和Naming Service组成,Config service 为Nacos配置中心核心模块,实现 了配置的增删改查、版本管理、灰度管理、监听管理。 [2] nacos 入门案例 -客户端:创建工程 阅读详情

相关推荐

九、Nacos源码系列:Nacos配置中心原理(一)- SpringCloud应用启动时拉取配置

至此,在项目启动的时候(上下文准备阶段)通过NacosPropertySourceLocator就拉取到了远程 Nacos 中的配置信息,并且封装成 NacosPropertySource对象,然后PropertySourceBootstrapConfiguration依靠ApplicationContextInitializer机制(容器刷新之前支持一些自定义初始化工作),将前面封装好的NacosPropertySource对象放到了 Spring 的环境变量Environment 中。

weixiaohuai的博客 2785

Spring Cloud 2.2.2 源码之二十七nacos客户端获取配置原理二

Spring Cloud 2.2.2 源码之二十六nacos客户端动态配置PropertySourceBootstrapConfigurationinitialize初始化一NacosPropertySourceLocator的locate PropertySourceBootstrapConfiguration 自动配置里有这个类,这个就是来进行远程配置处理的。 他也是个初始化器,因为在准备好...

王伟王胖胖的博客 2465

Spring Cloud Config Server:微服务配置中心从原理到实践

在微服务架构中,配置管理是保障系统一致性与可维护性的核心挑战。其核心原理在于将分散的配置文件集中存储,通过服务端与客户端的协同机制实现统一分发。这项技术的核心价值在于提升分布式系统的配置一致性、安全性和运维效率,广泛应用于需要多环境隔离、动态功能开关和敏感信息加密的场景。本文聚焦于Spring Cloud Config Server,深入解析其基于Git仓库的配置存储、客户端启动引导流程以及高可用部署方案,并结合配置加密、动态刷新等高级特性,为构建生产级配置中心提供完整实践指南。

weixin_33226548的博客 299

Spring Cloud Config 配置中心

当你使用Eureka作为注册中心时候,Eureka他是没有配置中心的,因此我们需要另一个组件对项目进行配置的管理 Spring Cloud Config (下面可能用SCC简称) 两种存配置的方法 1.数据库或者是磁盘 2.git仓库(git会记录历史版本,SCC默认存在GIT仓库) 使用步骤 1.准备Git仓库:查看idea是否配置GIT 2.在父项目的目录下新建文件夹config 3.复制要交给SCC要进行管理服务的配置到Config里 profile的用法: 主配置与很多pr...

MambaOut824的博客 1161

STM32F103单片机驱动TM1637数码管显示模块

最近项目中需要用到数码管显示,于是买了一个TM1637芯片驱动的四位数码显示模块,现将调试过程记录一下,方便以后参考。 使用的单片机是STM32F103C8T6最小系统 使用的数码管模块是TM1637四位数码管显示模块 实际运行效果 下面先看一下TM1637和数码管连接的具体线路图 实际使用的模块没有带按键,只用了4个数码管,模块和单片机连接只需要4根线VCC、GND、CLK、DIO。芯片和单片机通信使用的是I2C总线,下面就来说一下如何...

HXYDJ的博客 1万+

手把手教你理解MIS结构C-V特性曲线:从理论到测试实操

本文深入解析了金属-绝缘体-半导体(MIS)结构的电容-电压(C-V)特性曲线,从积累、耗尽到反型等物理状态出发,详细阐述了其测试原理与实操要点。文章重点介绍了如何通过C-V曲线提取氧化层厚度、掺杂浓度、界面态密度等关键参数,并探讨了偏压-温度(B-T)应力实验在揪出可动离子电荷等可靠性问题中的应用,为半导体器件物理研究与工艺评估提供了实用指南。

weixin_29304021的博客 445

【spring-cloud源码学习】config自动配置

两个问题: 服务端的是如何加载到了远端的配置? 为何在pom依赖“spring-cloud-starter-config”后就可以直接使用远端的配置? 一、前置说明: 本来准备看下SpringCloud中有关分布式配置相关的内容,但是在看源码的过程中发现SpringCloud很多组件的实现都是建立在Spring Application和SpringBoot的基础机制之上的。因此如果想真正搞懂S...

tfvglin的博客 1151

Codex Skill:AI编程助手的专项能力扩展与实战指南

在AI编程助手领域,Skill(技能)是一种标准化的能力扩展机制,它通过封装特定任务所需的指令、资源和脚本,解决AI模型在专项任务上的能力局限。其核心原理是将专业知识和工作流程模块化,让通用AI助手能够像领域专家一样执行复杂任务。从技术价值看,Skill不仅提升了代码生成的准确性,更重要的是实现了业务流程的自动化集成,如代码规范检查、API文档生成等具体场景。这种机制特别适用于需要结合内部工具链和特定业务逻辑的企业环境,能够显著提升开发效率和质量。通过安装PPT生成、SpringBoot项目创建等专项Ski

weixin_33672109的博客 415

常见的配置中心:Spring Cloud Config

概述 从下面的架构图可以看到传统的单体应用和一些小的SOA服务因为其服务数量较少,所以其配置能以服务为分割单位保存在每个服务当中,但是这样会面临多个问题:1、如果某个配置修改了,需要对所有服务重新打包。2、因为配置保存不同服务中,即代表着每增加一个服务就要增加对应配置的维护成本。 1.Spring Cloud Config 基于概述中提到的问题,还有在微服务架构中不断增加的服务数量,配置中心这种就应运而生。 Sp...

kiranet的专栏 827

Mac M1安装Hive

如果你确定装过mysql,但是执行上述命令后,发现不存在mysql命令,那说明你的系统环境没有配置。出现一段空白,接着出现Initialization script completed。关闭hiveServer2时,执行如下命令查看hive进程;执行上面命令后,若有结果输出,则证明配置完成了。如果出现mac权限问题,解决方法参考。就可以见到hive的web界面了。若出现路径,则存在mysql。配置好后保存,使配置文件生效。用户名hive,密码hive。用户名通过如下命令查看。通过如下命令杀死该进程。

总结复盘,才能不迷失自己! 2388

腾讯混元3D世界模型2.0实战:从AI生成到Unity/UE引擎集成全指南

生成式AI正在重塑3D内容创作流程,其核心原理是通过大语言模型理解自然语言描述,并驱动多阶段生成流水线自动创建3D资产与场景。这项技术为游戏开发、虚拟仿真和数字孪生领域带来了革命性的效率提升,能够将传统需要数周的美术协作流程压缩至几分钟。在实际应用中,开发者需要掌握本地环境部署、模型推理优化以及生成资产与主流游戏引擎的集成工作流。本文以腾讯开源的混元3D世界模型为例,详细解析如何将AI生成的场景通过插件高效导入Unity和Unreal Engine,并针对光照烘焙、材质调整、性能优化等工程实践问题提供解决方

cnracht8153的博客 1396

spring cloud config使用总结

1

weixin_43822598的博客 343

ComfyUI整合包V8中文版最新版介绍

和普通AI绘图网页不同,它把图像生成的每一个步骤拆分成一个个"节点",用连线把它们串起来,形成工作流。里面包含ComfyUI内核、Python运行环境、常用插件、部分预置模型,还有一个叫"绘世启动器"的图形界面管理工具。网上的对比数据显示,WebUI最低需要4G显存,ComfyUI最低3G显存就能运行。可以在里面管理插件、切换模型路径、设置显存模式、查看日志报错,还有"疑难解答"功能,遇到报错可以先扫描一下看是不是已知问题。原版ComfyUI的界面是英文的,右键菜单、节点名称全是英文。

欢迎来到鸾姝淡月博客,专为程序员和编程爱好者打造的技术博客。我们分享编程语言趋势、开发工具、编程哲学、职业发展等,助你掌握新技术,优化技能,激发编程热情。 5231

Spring Cloud 应用篇 之 Spring Cloud Config(配置中心)

从前几篇文章中我们就可以看出,在分布式系统中,服务数量会很多,如果要修改服务的配置文件,会很麻烦,这个时候,我们想把配置文件放在一个地方统一管理,实时更新,Spring Cloud 就给我们提供了这样一个组件——Spring Cloud Config。(一)简介Spring Cloud Config 支持配置文件放在远程仓库中,例如 Git、SVN,也可以挂载到本地。Spring Cloud Co...

永不止步 6157

打通ZYNQ的任督二脉:AXI_FIFO数据交互全解析

FIFO(First In First Out,先进先出)是一种经典的数据缓冲结构,就像排队买票一样,先来的人先得到服务。时钟域交叉(CDC):连接不同时钟频率的模块数据缓冲:平衡生产者和消费者的速度差异流量控制:防止数据丢失或溢出input clk,// 输入AXI4-Stream接口(从PS到PL)// 输出AXI4-Stream接口(从PL到PS)// 状态指示信号// 定义状态机状态// 数据缓存// 8个深度的缓存// 流水线处理寄存器。

QQ_778132974的博客 307

C#解析基恩士(KEYENCE)PLC数据:KV协议通信与实时监控实现

KV协议是基恩士PLC使用的一种专用通信协议,通常用于与上位机进行数据交换。KV协议通过RS-232C、RS-485、Ethernet等接口与上位机通信,支持多种数据类型的读写,包括但不限于位、字、双字、浮点数等。简洁易用:KV协议的通信格式简单,易于实现。支持多种数据类型:支持位数据、字数据、定长字符串等。高效实时性:能够提供较高的实时数据交换性能,适合实时监控应用。本文介绍了如何通过C#与基恩士KV系列PLC进行通信,实现数据的解析和实时监控功能。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1810

spring-cloud-config 源码解析

spring-cloud-config源码解析:   本文主要针对spring-cloud-dependencies Hoxton.SR4版本,spring-cloud-config-server/client的2.2.2.RELEASE版本进行源码的解析。   对于未接触过 Config的小伙伴可以参考https://www.cnblogs.com/wuzhenzha...

吴振照 756

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

spring cloud config使用与原理分析

spring cloud config是一个基于http协议的远程配置实现方式。通过统一的配置管理服务器进行配置管理,客户端通过https协议主动的拉取服务的的配置信息,完成配置获取。spring cloud config的使用方式非常简单,spring cloud config server默认的实现方式是git管理配置,官方文档介绍已经详细说明有几种使用方式。下面看一下git的spring cloud config server实现方式。SpringApplication实现,代码如下。 applica

web15185420056的博客 535

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Spring Cloud Config面试题

Spring Cloud Config高频面试题。

golove666的博客 1587

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Spring-Cloud-Config快速开始

Spring-Cloud-Config简介 Spring-Cloud-Config是Sping-Cloud下用于分布式配置管理的组件,分成了两个角色Config-Server和Config-Client;Config-Server端集中式存储/管理配置文件,并对外提供接口方便Config-Client访问,接口使用HTTP的方式对外提供访...

weixin_33739523的博客 83

19.Spring Cloud之分布式配置中心Spring Cloud Config

Spring Cloud Config是Spring Cloud团队创建的一个全新项目,用来为分布式系统中的基础设施和微服务应用提供集中化的外部配置支持,它分为服务端与客户端两个部分。其中服务端也称为分布式配置中心,它是一个独立的微服务应用,用来连接配置仓库并为客户端提供获取配置信息、加密/解密信息等访问接口;而客户端则是微服务架构中的各个微服务应用或基础设施,它们通过指定的配置中...

盲目的拾荒者的博客 418

对spring cloud config的一点理解

  以下部分纯属个人理解,但是结果都是经过demo验证。 一、spring cloud config介绍   spring cloud是spring家族中的一个微服务工具包,其中包含了很多微服务的工具。偏向于与spring boot类似的配置方式,有许多许多默认配置。spring cloud config是其中的一个工具包,用于配置的拉取更新。   举一个小小的例子,当我们程序中有一个配置文...

weixin_30602505的博客 134

Spring cloud 配置中心源码解读

https://blog.youkuaiyun.com/sinat_25518349/article/details/86323476#ConfigServicePropertySourceLocator_266 https://www.cnblogs.com/niechen/p/8979578.html Spring-cloud -config-server 1:入口 @EnableCo...

等风的小猪 582

Spring Cloud相关配置管理

      Spring Cloud是基于Spring Boot之上主要用于分布式架构。对于分布式架构提供了很多管理配置   例如:服务注册与发现(Eureka)、消费者(Ribbon and Feign)、断路器(Hystrix)、路由网关(Zuul)、分布式配置中心(Config)以及高可用的服务注册中心。对于Dubbo+Zookeeper分布式架构要简单很多。下面介绍下各配置的相关内容: ...

looplook21的博客 1564

Spring Cloud 微服务实战入门(五)配置中心Spring Cloud Config

Spring Cloud Config 允许应用程序在运行时动态获取所需的配置,这使得配置的修改和更新可以在不重新部署应用程序的情况下生效,增强了应用的灵活性和可维护性,而且支持不同的配置格式,如Properties、YML等,并且能够为不同的应用实例提供特定的配置。总的来说,Spring Cloud Config为微服务架构中的配置管理提供了一种高效、可靠、灵活的解决方案,可以帮助开发团队更好地应对日益复杂的分布式系统配置管理挑战,提高了开发效率和系统的稳定性,是构建现代化微服务应用的重要工具。

毛尖 639
上一篇: Spirng Cloud Config Server使用
下一篇: Spriing Cloud Config Server工作原理
思维的深度
博客等级 码龄11年 2万+粉丝 391原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值