Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

属性配置优先级问题 #338

Open
wangdefeng opened this issue Jan 21, 2025 · 1 comment
Open

属性配置优先级问题 #338

wangdefeng opened this issue Jan 21, 2025 · 1 comment

Comments

@wangdefeng
Copy link

Spring Boot 工程,属性配置默认在Nacos Config中,本地环境启动Spring Boot 服务时需要覆盖Nacos Config中对应的属性配置(主要是nebula.hosts)。在IDEA 运行参数设置 nebula.hosts 为VPN地址时,发现 NgbatisContextInitializer的initialize 方法被调用了两次,第一次是本地属性被调用,第二次为Nacos Config 中设置的Nebula相关属性被调用,导致服务无法正常启动,Nacos Config 中设置信息只能在公司内网中使用。公司之外需要请求VPN地址才可以。
按照Spring Boot 属性配置优先级原则,初始化客户端应该只初始化一次,且为配置优先级最高的属性为准。

@CorvusYe
Copy link
Collaborator

之前针对nacos的适配相对简单些,本地参数放空,以第二次从nacos读的值为准。
两个环境nacos应该是不一样的吧?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants