spring-cloud-alibaba icon indicating copy to clipboard operation
spring-cloud-alibaba copied to clipboard

NacosConfigManger ConfigService need reload

Open SKYhuangjing opened this issue 2 years ago • 6 comments

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 We recommend using English. If you are non-native English speaker, you can use the translation software.

Which Component Nacos Config Starter

Describe the bug when NacosConfigProperties has been changed, bug NacosConfigManager configservice can't reload it.

To Reproduce Steps to reproduce the behavior:

  1. set bootstrap.yml namespace is xx_${spring.profiles.active}
  2. use nacosConfigManager serivce in biz code.
  3. when get or publish config to nacos server, it will be throw warn invalid tenant

Expected behavior get or publish success

SKYhuangjing avatar May 12 '22 07:05 SKYhuangjing

Please provider your version information of Spring Cloud Alibaba and give us a simplified demo to reproduce it.

steverao avatar May 12 '22 11:05 steverao

Can you give a demo to reproduce it ?

DanielLiu1123 avatar May 13 '22 11:05 DanielLiu1123

update demo later..

SKYhuangjing avatar May 13 '22 12:05 SKYhuangjing

Spring Cloud Alibaba version 2021.0.1.0 Spring Boot Version 2.6.7

demo url : https://github.com/SKYhuangjing/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-config-example

run the demo and

curl http://localhost:8080/config/getConfigNamespace

Actual result : business_group_${spring.profiles.active}% Expect result : business_group_local

ps : so I can't use configService in NacosConfigManager, need regenerate ConfigService from NacosFactory.createConfigService.

SKYhuangjing avatar May 13 '22 13:05 SKYhuangjing

  1. I remember namespace should be the namespace id ?
  2. bootstrap.yml was loaded before application.yml, so you can't get spring.profiles.active when bootstrap.yml was loading.

DanielLiu1123 avatar May 15 '22 10:05 DanielLiu1123

  1. I remember namespace should be the namespace id ?
  2. bootstrap.yml was loaded before application.yml, so you can't get spring.profiles.active when bootstrap.yml was loading.

Question 1 : I have set the namesapce id and name is same Question 2 : Yes, I know it, in this senario, I debug the init source code, nacosConfigProperties will be set many times, so namespace value will be fine, but configservice will init in first time, if we need use nacosconfigManager.configService, It can't work, so I want know the nacos offical site have plan to fix it ?

SKYhuangjing avatar May 16 '22 01:05 SKYhuangjing

For an general application, it just need an object of Config Service, we intentionally make it load only once, can you describe in detail why you need to use NacosConfigManager.configService directly?

steverao avatar Dec 26 '22 15:12 steverao

For an general application, it just need an object of Config Service, we intentionally make it load only once, can you describe in detail why you need to use NacosConfigManager.configService directly?

I have provide my demo, in my senario, I need use dynamic namespace config, but the Config Service will not init correct in daynamic config, i just want know, offical site will fix it?

SKYhuangjing avatar Dec 27 '22 01:12 SKYhuangjing

This issue has been open 30 days with no activity. This will be closed in 7 days.

github-actions[bot] avatar Nov 19 '23 18:11 github-actions[bot]

This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community.

github-actions[bot] avatar Dec 01 '23 18:12 github-actions[bot]