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

prioriry don't work when configuring priority between dataids with @NacosPropertySources #142

Closed
chuntaojun opened this issue Aug 19, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@chuntaojun
Copy link
Member

priority between dataids in @NacosPropertySources

Type: bug report

Consider this scenario

  • specific the order of several dataids configured with NacosPropertySources annotation in Nacos Spring Boot
  • same property key included in multi dataids
  • autoRefresh enabled

Here is an example

@NacosPropertySources({
        @NacosPropertySource(dataId = "example.properties", autoRefreshed = true),
        @NacosPropertySource(dataId = "second_example.properties", autoRefreshed = true,after ="example.properties" )
})

property value changed no matter which dataid is modified , however my expectation is only property key in the top priority dataid takes effect

@chuntaojun
Copy link
Member Author

This relationship has, is the need to set the PropertySource name attribute to set, For nacos data structure design, under the same namespace, because of the existence of the group, data - id is the same, the possible so we can not only distinguish, according to the configuration data - id do it according to the data - id + group, internal by calculating a NacosPropertySource unique id as the default value of the name attribute, so if there is a priority setting their own configuration, is the need to manually set the name attribute

example

@NacosPropertySources({
        @NacosPropertySource(name = "first", dataId = "example.properties", autoRefreshed = true),
        @NacosPropertySource(name = "second", dataId = "second_example.properties", autoRefreshed = true,after ="first" )
})

nacos-spring-project automation moved this from To do to Done Aug 19, 2019
@jaryur
Copy link

jaryur commented Aug 26, 2019

I think u misunderstood my description :(
Here is the complete scenario

  • PropertySource configuration
@NacosPropertySources({
        @NacosPropertySource(name = "first", dataId = "example.properties", autoRefreshed = true),
        @NacosPropertySource(name = "second", dataId = "second_example.properties", autoRefreshed = true,after ="first" )
})

all these two property sources contain a same property named key

  • Nacos value is set as autoRefreshed=true
 @NacosValue(value = "${key}", autoRefreshed = true)
 private String key;

when I modified key in dataid second_example.properties, property key will be refreshed ,which is totally against my priority rule second_example.properties should be after example.properties

@chuntaojun chuntaojun reopened this Aug 26, 2019
nacos-spring-project automation moved this from Done to To do Aug 26, 2019
@chuntaojun
Copy link
Member Author

I understand, this is really a bug,I'll fix it

@chuntaojun chuntaojun added the bug Something isn't working label Aug 26, 2019
@chuntaojun chuntaojun mentioned this issue Sep 6, 2019
5 tasks
nacos-spring-project automation moved this from To do to Done Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants