spring-cloud-alibaba
spring-cloud-alibaba copied to clipboard
NacosConfigManger ConfigService need reload
我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 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:
- set bootstrap.yml namespace is xx_${spring.profiles.active}
- use nacosConfigManager serivce in biz code.
- when get or publish config to nacos server, it will be throw warn invalid tenant
Expected behavior get or publish success
Please provider your version information of Spring Cloud Alibaba and give us a simplified demo to reproduce it.
Can you give a demo to reproduce it ?
update demo later..
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.
- I remember
namespace
should be the namespace id ? -
bootstrap.yml
was loaded beforeapplication.yml
, so you can't getspring.profiles.active
whenbootstrap.yml
was loading.
- I remember
namespace
should be the namespace id ?bootstrap.yml
was loaded beforeapplication.yml
, so you can't getspring.profiles.active
whenbootstrap.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 ?
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?
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?
This issue has been open 30 days with no activity. This will be closed in 7 days.
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.