SpringBoot的配置如何动态刷新(Nacos实现)

SpringBoot整合Nacos配置中心,实现动态刷新 SpringBoot整合nacos,并实现动态刷新 阅读详情

Nacos启动加载配置

        通过  META-INF/spring.factories 加载  NacosConfigBootstrapConfiguration

org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.alibaba.cloud.nacos.NacosConfigBootstrapConfiguration

初始化 NacosConfigProperties 和 NacosPropertySourceLocator

@Configuration
@ConditionalOnProperty(name = "spring.cloud.nacos.config.enabled", matchIfMissing = true)
public class NacosConfigBootstrapConfiguration {

	@Bean
	@ConditionalOnMissingBean
	public NacosConfigProperties nacosConfigProperties() {
		return new NacosConfigProperties();
	}

	@Bean
	public NacosPropertySourceLocator nacosPropertySourceLocator(
			NacosConfigProperties nacosConfigProperties) {
		return new NacosPropertySourceLocator(nacosConfigProperties);
	}

}

通过 com.alibaba.cloud.nacos.client.NacosPropertySourceLocator 加载配置到 org.springframework.core.env.Environment

@Override
	public PropertySource<?> locate(Environment env) {

		ConfigService configService = nacosConfigProperties.configServiceInstance();

		if (null == configService) {
			log.warn("no instance of config service found, can't load config from nacos");
			return null;
		}
		long timeout = nacosConfigProperties.getTimeout();
		nacosPropertySourceBuilder = new NacosPropertySourceBuilder(configService,
				timeout);
		String name = nacosConfigProperties.getName();

		String dataIdPrefix = nacosConfigProperties.getPrefix();
		if (StringUtils.isEmpty(dataIdPrefix)) {
			dataIdPrefix = name;
		}

		if (StringUtils.isEmpty(dataIdPrefix)) {
			dataIdPrefix = env.getProperty("spring.application.name");
		}

		CompositePropertySource composite = new CompositePropertySource(
				NACOS_PROPERTY_SOURCE_NAME);

		loadSharedConfiguration(composite);
		loadExtConfiguration(composite);
		loadApplicationConfiguration(composite, dataIdPrefix, nacosConfigProperties, env);

		return composite;
	}

Nacos启动注册 com.alibaba.nacos.api.config.listener.Listener

通过  META-INF/spring.factories 加载  NacosConfigAutoConfiguration

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.cloud.nacos.NacosConfigAutoConfiguration,\
com.alibaba.cloud.nacos.endpoint.NacosConfigEndpointAutoConfiguration

初始化 com.alibaba.cloud.nacos.refresh.NacosContextRefresher 实现启动注册 Listener

    @Override
	public void onApplicationEvent(ApplicationReadyEvent event) {
		// many Spring context
		if (this.ready.compareAndSet(false, true)) {
			this.registerNacosListenersForApplications();
		}
	}

    private void registerNacosListenersForApplications() {
		if (refreshProperties.isEnabled()) {
			for (NacosPropertySource nacosPropertySource : NacosPropertySourceRepository
					.getAll()) {

				if (!nacosPropertySource.isRefreshable()) {
					continue;
				}

				String dataId = nacosPropertySource.getDataId();
				registerNacosListener(nacosPropertySource.getGroup(), dataId);
			}
		}
	}

	private void registerNacosListener(final String group, final String dataId) {

		Listener listener = listenerMap.computeIfAbsent(dataId, i -> new Listener() {
			@Override
			public void receiveConfigInfo(String configInfo) {
				refreshCountIncrement();
				String md5 = "";
				if (!StringUtils.isEmpty(configInfo)) {
					try {
						MessageDigest md = MessageDigest.getInstance("MD5");
						md5 = new BigInteger(1, md.digest(configInfo.getBytes("UTF-8")))
								.toString(16);
					}
					catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
						log.warn("[Nacos] unable to get md5 for dataId: " + dataId, e);
					}
				}
				refreshHistory.add(dataId, md5);
				applicationContext.publishEvent(
						new RefreshEvent(this, null, "Refresh Nacos config"));
				if (log.isDebugEnabled()) {
					log.debug("Refresh Nacos config group " + group + ",dataId" + dataId);
				}
			}

			@Override
			public Executor getExecutor() {
				return null;
			}
		});

		try {
			configService.addListener(dataId, group, listener);
		}
		catch (NacosException e) {
			e.printStackTrace();
		}
	}

 通过 applicationContext.publishEvent(new RefreshEvent(this, null, "Refresh Nacos config")); 发布更新事件, 触发监听器操作 org.springframework.cloud.endpoint.event.RefreshEventListener

org.springframework.cloud.endpoint.event.RefreshEventListener


    @Override
	public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
		return ApplicationReadyEvent.class.isAssignableFrom(eventType)
				|| RefreshEvent.class.isAssignableFrom(eventType);
	}

	@Override
	public void onApplicationEvent(ApplicationEvent event) {
		if (event instanceof ApplicationReadyEvent) {
			handle((ApplicationReadyEvent) event);
		}
		else if (event instanceof RefreshEvent) {
			handle((RefreshEvent) event);
		}
	}

	public void handle(ApplicationReadyEvent event) {
		this.ready.compareAndSet(false, true);
	}

	public void handle(RefreshEvent event) {
		if (this.ready.get()) { // don't handle events before app is ready
			log.debug("Event received " + event.getEventDesc());
			Set<String> keys = this.refresh.refresh();
			log.info("Refresh keys changed: " + keys);
		}
	}

监听器触发调用 org.springframework.cloud.context.refresh.ContextRefresher.refresh()

	public synchronized Set<String> refresh() {
		Set<String> keys = refreshEnvironment();
		this.scope.refreshAll();
		return keys;
	}

	public synchronized Set<String> refreshEnvironment() {
		Map<String, Object> before = extract(
				this.context.getEnvironment().getPropertySources());
		addConfigFilesToEnvironment();
		Set<String> keys = changes(before,
				extract(this.context.getEnvironment().getPropertySources())).keySet();
		this.context.publishEvent(new EnvironmentChangeEvent(this.context, keys));
		return keys;
	}



Set<String> keys = refreshEnvironment();
    1. 实现 Environment 的刷新 
    2. 获取配置发生变化的 key
    3. EnvironmentChangeEvent 事件的发布, 触发监听 
org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder
实现 org.springframework.boot.context.properties.ConfigurationProperties 注解的刷新


this.scope.refreshAll();
    刷新 org.springframework.cloud.context.scope.refresh.RefreshScope 管理的Bean


Nacos实现监听

通过  META-INF/spring.factories 加载  NacosConfigAutoConfiguration

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.cloud.nacos.NacosConfigAutoConfiguration,\
com.alibaba.cloud.nacos.endpoint.NacosConfigEndpointAutoConfiguration

根据配置获取 com.alibaba.nacos.api.config.ConfigService

设置  com.alibaba.nacos.client.config.impl.ClientWorker

 1. 获取ConfigService  com.alibaba.cloud.nacos.NacosConfigAutoConfiguration.nacosContextRefresher(NacosConfigProperties, NacosRefreshProperties, NacosRefreshHistory)

     @Bean
	public NacosContextRefresher nacosContextRefresher(
			NacosConfigProperties nacosConfigProperties,
			NacosRefreshProperties nacosRefreshProperties,
			NacosRefreshHistory refreshHistory) {
		return new NacosContextRefresher(nacosRefreshProperties, refreshHistory,
				nacosConfigProperties.configServiceInstance());
	}

2. 获取 ConfigService  
com.alibaba.cloud.nacos.NacosConfigProperties.configServiceInstance()

3. 工厂方法获取 ConfigService
com.alibaba.nacos.api.NacosFactory.createConfigService(Properties)

    public static ConfigService createConfigService(Properties properties) throws NacosException {
        try {
            Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
            Constructor constructor = driverImplClass.getConstructor(Properties.class);
            ConfigService vendorImpl = (ConfigService) constructor.newInstance(properties);
            return vendorImpl;
        } catch (Throwable e) {
            throw new NacosException(NacosException.CLIENT_INVALID_PARAM, e);
        }
    }

4. 反射生成 NacosConfigService
com.alibaba.nacos.client.config.NacosConfigService.NacosConfigService(Properties)

    public NacosConfigService(Properties properties) throws NacosException {
        String encodeTmp = properties.getProperty(PropertyKeyConst.ENCODE);
        if (StringUtils.isBlank(encodeTmp)) {
            encode = Constants.ENCODE;
        } else {
            encode = encodeTmp.trim();
        }
        initNamespace(properties);
        agent = new MetricsHttpAgent(new ServerHttpAgent(properties));
        agent.start();
        worker = new ClientWorker(agent, configFilterChainManager, properties);
    }

5. 实例化 ClientWorker
com.alibaba.nacos.client.config.impl.ClientWorker.ClientWorker(HttpAgent, ConfigFilterChainManager, Properties)

ClientWorker 实现定时检测 10ms 检测一次

@SuppressWarnings("PMD.ThreadPoolCreationRule")
    public ClientWorker(final HttpAgent agent, final ConfigFilterChainManager configFilterChainManager, final Properties properties) {
        this.agent = agent;
        this.configFilterChainManager = configFilterChainManager;

        // Initialize the timeout parameter

        init(properties);

        executor = Executors.newScheduledThreadPool(1, new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread t = new Thread(r);
                t.setName("com.alibaba.nacos.client.Worker." + agent.getName());
                t.setDaemon(true);
                return t;
            }
        });

        executorService = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors(), new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread t = new Thread(r);
                t.setName("com.alibaba.nacos.client.Worker.longPolling." + agent.getName());
                t.setDaemon(true);
                return t;
            }
        });

        executor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                try {
                    checkConfigInfo();
                } catch (Throwable e) {
                    LOGGER.error("[" + agent.getName() + "] [sub-check] rotate check error", e);
                }
            }
        }, 1L, 10L, TimeUnit.MILLISECONDS);
    }



executor 定时运行 com.alibaba.nacos.client.config.impl.ClientWorker.checkConfigInfo()
    单线程 10ms 执行一次
executorService 运行 LongPollingRunnable 

LongPollingRunnable 长轮训实现变化通知

com.alibaba.nacos.client.config.impl.ClientWorker.LongPollingRunnable


        @Override
        public void run() {

            List<CacheData> cacheDatas = new ArrayList<CacheData>();
            List<String> inInitializingCacheList = new ArrayList<String>();
            try {
                // check failover config
                for (CacheData cacheData : cacheMap.get().values()) {
                    if (cacheData.getTaskId() == taskId) {
                        cacheDatas.add(cacheData);
                        try {
                            checkLocalConfig(cacheData);
                            if (cacheData.isUseLocalConfigInfo()) {
                                cacheData.checkListenerMd5();
                            }
                        } catch (Exception e) {
                            LOGGER.error("get local config info error", e);
                        }
                    }
                }

                // check server config
                List<String> changedGroupKeys = checkUpdateDataIds(cacheDatas, inInitializingCacheList);

                for (String groupKey : changedGroupKeys) {
                    String[] key = GroupKey.parseKey(groupKey);
                    String dataId = key[0];
                    String group = key[1];
                    String tenant = null;
                    if (key.length == 3) {
                        tenant = key[2];
                    }
                    try {
                        String content = getServerConfig(dataId, group, tenant, 3000L);
                        CacheData cache = cacheMap.get().get(GroupKey.getKeyTenant(dataId, group, tenant));
                        cache.setContent(content);
                        LOGGER.info("[{}] [data-received] dataId={}, group={}, tenant={}, md5={}, content={}",
                            agent.getName(), dataId, group, tenant, cache.getMd5(),
                            ContentUtils.truncateContent(content));
                    } catch (NacosException ioe) {
                        String message = String.format(
                            "[%s] [get-update] get changed config exception. dataId=%s, group=%s, tenant=%s",
                            agent.getName(), dataId, group, tenant);
                        LOGGER.error(message, ioe);
                    }
                }
                for (CacheData cacheData : cacheDatas) {
                    if (!cacheData.isInitializing() || inInitializingCacheList
                        .contains(GroupKey.getKeyTenant(cacheData.dataId, cacheData.group, cacheData.tenant))) {
                        cacheData.checkListenerMd5();
                        cacheData.setInitializing(false);
                    }
                }
                inInitializingCacheList.clear();

                executorService.execute(this);

            } catch (Throwable e) {

                // If the rotation training task is abnormal, the next execution time of the task will be punished
                LOGGER.error("longPolling error : ", e);
                executorService.schedule(this, taskPenaltyTime, TimeUnit.MILLISECONDS);
            }
        }
    }
## com.alibaba.nacos.client.config.impl.ClientWorker.LongPollingRunnable

1. 循环遍历 CacheData
2. 检测本地配置
    com.alibaba.nacos.client.config.impl.ClientWorker.checkLocalConfig(CacheData)
3. 如果是 本地配置,执行md5对比
    if (cacheData.isUseLocalConfigInfo()) { cacheData.checkListenerMd5(); }


## com.alibaba.nacos.client.config.impl.CacheData
1. 执行 md5 对比
    com.alibaba.nacos.client.config.impl.CacheData.checkListenerMd5()
2. 如果 md5 发生变化, 执行回调
    com.alibaba.nacos.client.config.impl.CacheData.safeNotifyListener(String, String, String, String, ManagerListenerWrap)
3. 执行 listener 回调 : 存在线程池, 线程池执行, 不存在直接运行




private void safeNotifyListener(final String dataId, final String group, final String content,
                                    final String md5, final ManagerListenerWrap listenerWrap) {
        final Listener listener = listenerWrap.listener;

        Runnable job = new Runnable() {
            @Override
            public void run() {
                ClassLoader myClassLoader = Thread.currentThread().getContextClassLoader();
                ClassLoader appClassLoader = listener.getClass().getClassLoader();
                try {
                    if (listener instanceof AbstractSharedListener) {
                        AbstractSharedListener adapter = (AbstractSharedListener) listener;
                        adapter.fillContext(dataId, group);
                        LOGGER.info("[{}] [notify-context] dataId={}, group={}, md5={}", name, dataId, group, md5);
                    }
                    // 执行回调之前先将线程classloader设置为具体webapp的classloader,以免回调方法中调用spi接口是出现异常或错用(多应用部署才会有该问题)。
                    Thread.currentThread().setContextClassLoader(appClassLoader);

                    ConfigResponse cr = new ConfigResponse();
                    cr.setDataId(dataId);
                    cr.setGroup(group);
                    cr.setContent(content);
                    configFilterChainManager.doFilter(null, cr);
                    String contentTmp = cr.getContent();
                    listener.receiveConfigInfo(contentTmp);
                    listenerWrap.lastCallMd5 = md5;
                    LOGGER.info("[{}] [notify-ok] dataId={}, group={}, md5={}, listener={} ", name, dataId, group, md5,
                        listener);
                } catch (NacosException de) {
                    LOGGER.error("[{}] [notify-error] dataId={}, group={}, md5={}, listener={} errCode={} errMsg={}", name,
                        dataId, group, md5, listener, de.getErrCode(), de.getErrMsg());
                } catch (Throwable t) {
                    LOGGER.error("[{}] [notify-error] dataId={}, group={}, md5={}, listener={} tx={}", name, dataId, group,
                        md5, listener, t.getCause());
                } finally {
                    Thread.currentThread().setContextClassLoader(myClassLoader);
                }
            }
        };

        final long startNotify = System.currentTimeMillis();
        try {
            if (null != listener.getExecutor()) {
                listener.getExecutor().execute(job);
            } else {
                job.run();
            }
        } catch (Throwable t) {
            LOGGER.error("[{}] [notify-error] dataId={}, group={}, md5={}, listener={} throwable={}", name, dataId, group,
                md5, listener, t.getCause());
        }
        final long finishNotify = System.currentTimeMillis();
        LOGGER.info("[{}] [notify-listener] time cost={}ms in ClientWorker, dataId={}, group={}, md5={}, listener={} ",
            name, (finishNotify - startNotify), dataId, group, md5, listener);
    }

com.alibaba.nacos.api.config.listener.Listener 触发 receiveConfigInfo 即可发布刷新事件,完成RefreshEvent 的触发

Spring Cloud Alibaba Nacos Config - - - >@RefreshScope动态获取刷新后的配置内容 配置通常用在 Bean 里面,在 Bean 中通过@Value 注解来获取配置信息,但 @Value 可以获取到配置中心的值,却无法动态感知获取修改后的配置内容。想要 @Value 可以动态获取配置修改后的值,需要在 Bean 上添加 @RefreshScope 注解。 阅读详情

相关推荐

SpringBoot集成Nacos配置中心:从基础配置到动态刷新实战

本文详细介绍了SpringBoot集成Nacos配置中心的完整流程,从基础环境配置到动态刷新机制实现。通过核心注解使用、多环境管理、安全配置等实战案例,帮助开发者快速掌握Nacos在微服务架构中的配置管理能力,提升应用的可维护性和灵活性。

weixin_30902251的博客 513

实现Nacos属性值自动刷新的三种方式

在Spring Boot项目中,我们经常使用Nacos作为配置中心,用于管理应用程序的属性配置。当我们在Nacos上修改属性值时,希望应用程序能够自动刷新并应用最新的属性值,以避免重启应用。本篇博客将介绍三种实现Nacos属性值自动刷新的方式,并提供相应的示例代码。

算命de博客 8497

【spring boot】[nacos] ----一篇文章搞懂 nacos 底层动态刷新配置原理超详细

Nacos实现动态配置刷新的核心在于长轮询机制和应用内配置更新。客户端每30秒发起一次长轮询请求,服务端有变更立即返回数据,无变更则阻塞30秒后响应。获取新配置后,客户端会重新加载完整的配置文件,并触发@RefreshScope标记的Bean重新初始化。这种机制适用于可热更新的无状态配置,如开关参数、业务规则等,但对于数据库连接等关键配置需谨慎处理,避免运行时错误。通过将配置管理从本地静态加载转为远程动态监听,实现了配置变更的实时生效而无需重启服务。

记录生活 1224

如何实现Nacos配置文件动态刷新【四种方式】

在Nacos中,动态刷新配置文件的实现方式可以总结如下:使用Spring Cloud Config + Nacos:结合Spring Cloud Config和Nacos作为配置中心,在应用程序中添加注解,并使用@Value注解绑定配置属性。通过发送POST请求到端点来触发配置的刷新。使用Nacos的ConfigListener接口:实现ConfigListener接口,并注册为Nacos的监听器。当配置发生变化时,回调相应方法进行处理。

怀着一颗学徒的心 2万+

SpringBoot+Nacos配置安全升级:Jasypt 3.0.5实现敏感信息加密与动态刷新

在微服务架构中,配置中心集中管理着数据库密码、API密钥等敏感信息,其安全性至关重要。配置加密是保障数据安全的基础技术,其核心原理是在存储和传输过程中对敏感数据进行混淆处理,防止明文泄露。Jasypt作为Java生态中成熟的加密库,提供了非侵入式的透明解密方案,能无缝集成Spring框架,在属性加载阶段自动识别并解密密文,对业务代码零侵入。其技术价值在于,它实现了“配置中心存密文,应用内存用明文”的安全状态,有效防范因配置泄露导致的数据拖库、密钥盗用等安全风险。该方案尤其适用于使用Nacos、Apollo等

weixin_34378767的博客 332

Springboot 接口方式硬通知实现ConfigurationProperties 、@Value 动态刷新

Springboot 接口方式硬通知实现 动态刷新配置值,@ConfigurationProperties 、@Value 都可以

默默不代表沉默 1912

nacos 配置动态刷新_springboot2.x整合nacos配置服务实现配置获取及刷新

本文我将带领大家在springboot2.x的开发框架中整合alibaba-nacos,实现配置获取及刷新等功能。引用官方介绍:Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集,帮助您实现动态服务发现、服务配置管理、服务及流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。Nacos 是构建以“服务”为中心的现代应用架构(例如微服务范式、云原...

weixin_36192634的博客 1114

联邦学习模型投毒研究进展

在联邦学习中,多个设备(如移动设备、IoT设备等)本地训练模型,然后将更新的模型参数上传到服务器进行聚合。

2401_82375734的博客 1266

nacos+springboot配置文件动态刷新源码实现分析

nacos+spring配置自动刷新原理

Tt1814964226的博客 1006

非凸问题的求解方法以及连续凸逼近SCA(Successive Convex Approximation)方法

非凸问题的求解方法 针对形如下式的函数: min⁡x∈XV(x)=F(x)+G(x)\min\limits_{{\bf{x}}\in X} V(x)=F(x)+G(x)x∈Xmin​V(x)=F(x)+G(x); 其中F为光滑的(不一定convex),G是convex的但是可能不可微,且存在:对于n维实矢量空间,有X=X1×...×XNX=X_1 \times...\times X_NX=X1​×...×XN​; x=(x1,...,xN)\bf{x} =(x_1,...,x_N)x=(x1​,...,xN

weixin_44535200的博客 2万+

World Creator地形导入UE

导出预设选择高度图(heigh map)格式选择PNG 16位,或者RAW 16位,需要反转y轴(与虚幻不同),命名格式会自动带一个× , 将×改成_ 或者删掉自己命名 (虚幻名称不支持x符号)导入虚幻 , 修改Z轴 , 就是用 地形最高 - 地形最低 , 然后除以512 , 再乘以100。把这个数字填入Z轴缩放 , 点击生成即可。

UE星空 2154

nacos 配置不会动态刷新_springboot nacos使用配置

前言随着框架的不断更新迭代,springboot、springcloud使用率越来越高,注册中心、动态配置等成为日常开发中一项重要的存在,nacos这款外部应用,侵入性小的组件也越来被开发者所接受,今天小编来盘盘它☺1.nacos传送门【目前最新版本1.3.2】https://github.com/alibaba/nacos/releases2.将下载好的nacos1.3.2解压,并将MySQL依...

weixin_39775428的博客 1208

Open3D 计算点云基本特征

在 Open3D 中,可以通过 PCA(主成分分析)来求得点云的特征值和特征向量。然后基于这些特征值,进一步计算各种几何特征,如线性、平面性、球度等。

纵马踏花向自由 1606

nacos动态配置数据源_SpringBoot集成nacos动态刷新数据源的实现示例

前言因为项目需要,需要在项目运行过程中能够动态修改数据源(即:数据源的热更新)。这里以com.alibaba.druid.pool.DruidDataSource数据源为例第一步:重写DruidAbstractDataSource类这里为什么要重写这个类:因为DruidDataSource数据源在初始化后,就不允许再重新设置数据库的url和userNamepublic void setUrl(St...

weixin_32187075的博客 1082

C#上位机+YOLO工业视觉全实战:从ONNX部署到产线缺陷检测落地(2026年工业级实战指南)

在2026年,工业视觉落地的核心挑战不是“能不能做”,而是“能不能在产线实时跑起来C#为何成为最优解?

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

Sigrity Power SI Model Extraction模式如何提取电源网络的S参数和阻抗操作指导(一)

34. 默认格式是BNP format格式,会被Sigrity识别的S参数文件,在仿真完成后,默认会在文件夹中生成bnp和ckt(MCP)文件,无需这步操作。由于port设置的ref Z是50ohm,实际上电源网络的阻抗是没有这么高的,所以S参数回损曲线是基本上全反射的一个状态。Sigrity PowerSI是频域电磁场仿真工具,以下图为例介绍如果用它观测电源的网络的S参数以及阻抗的频域曲线.42. Spice格式的加载进来图标是橙色的,BNP格式的图标是灰色的。

weixin_54787054的博客 1279

SpringBoot应用如何借助Nacos实现配置的集中管理与动态刷新

本文详细介绍了SpringBoot应用如何通过Nacos实现配置的集中管理与动态刷新。从环境搭建到生产部署,涵盖了命名空间规划、配置文件最佳实践、动态刷新机制及常见问题排查,帮助开发者高效管理微服务配置,提升运维效率。

weixin_26869081的博客 388

015、架构_配置文件_管理节点(proxymanager.ini)

该配置文件中的参数在后台配置,两种生效方式:*所有参数重启生效。*部分参数可以使用工具dbtool动态生效。动态生效命令为:dbtool-pm-load-config。配置文件“proxymanager.ini”用于设置元数据管理模块的信息。文件路径为“~/etc”。配置文件“proxymanager.ini”是普通的文本文件。默认值proxymanager-alarmconfutf8.txt。配置错误或不配置,PM无法连接MDS,无法服务。获取元数据失败超时处理时间。异常时请求启动对等回滚。

Oracle/MySQL 到 国产信创数据库|迁移 · 调优 · 信创替换 329

nacos 配置动态刷新_springboot nacos使用配置

前言随着框架的不断更新迭代,springboot、springcloud使用率越来越高,注册中心、动态配置等成为日常开发中一项重要的存在,nacos这款外部应用,侵入性小的组件也越来被开发者所接受,今天小编来盘盘它☺1.nacos传送门【目前最新版本1.3.2】https://github.com/alibaba/nacos/releases2.将下载好的nacos1.3.2解压,并将MySQL依...

weixin_34512840的博客 1139

第42章:AI代码生成的质量标准——何时用AI、何时自己写

> - AI代码生成的质量分级标准:可用、稳定、安全、优雅 > - 一个决策矩阵:什么场景适合用AI,什么场景必须人工编写 > - 如何评估AI生成的代码质量(复杂度、可读性、安全性) > - 实战对比:同一需求下AI生成代码 vs 人工编写代码 > - 团队落地:将质量标准集成到Code Review和CI流程 > - 我如何将团队AI代码接受率从70%提升到90%

sfishfly的博客 161

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

SpringBoot整合nacos配置中心 支持动态刷新

自己搜了好多相关的文章发现好多都是springcloud的居多 关于springboot的很少 如果你也跟我一样不是微服务的项目话那么或许会帮到你。这里我们不能新建bootstrap.yml来进行配置 我们得使用原始的配置文件进行配置就可以了。到此关于nacos服务端的配置完毕 以上跟微服务的操作基本一致 所以在此就不贴图详细赘述了。在命名空间内新建一个新的命名空间 方便后期的维护 避免和其他项目混在一起。3.在配置列表内选择自己的命名空间建立新的配置。auto-refresh改为 true。

weixin_48692011的博客 1597

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

nacos动态配置数据源_SpringBoot集成nacos动态刷新数据源实现代码示例

本篇文章小编给大家分享一下SpringBoot集成nacos动态刷新数据源实现代码示例,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。第一步:重写DruidAbstractDataSource类这里为什么要重写这个类:因为DruidDataSource数据源在初始化后,就不允许再重新设置数据库的url和userNamepublic void setU...

weixin_35691526的博客 2577

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

spring boot nacos 配置动态刷新

使用注解 @RefreshScope 来达到配置动态刷新的效果,也可以加载 controller 上使配置动态刷新,本次使用配置类。共享配置使用动态刷新需要开启动态刷新配置。

zhucegemingzizheng的博客 2378

springboot使用动态刷新nacos配置

使用注解 @RefreshScope 来达到配置动态刷新的效果,也可以加载 controller 上使配置动态刷新,本次使用配置类。refresh: true # 是否动态刷新,默认为false。group: DEFAULT_GROUP # 默认为DEFAULT_GROUP。group: DEFAULT_GROUP # 默认为DEFAULT_GROUP。2,在nacos配置中加refresh: true。共享配置使用动态刷新需要开启动态刷新配置。1.默认配置动态刷新。

yuhui666666的博客 1319
上一篇: SpringBoot的配置如何动态刷新(方案)
下一篇: SpringBoot的配置如何动态刷新(自定义)
xinyuan_java
博客等级 码龄12年 181粉丝 83原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值