Spring-cloud-config: Some suggestions for Refresh.refreshAll()

Created on 2 Aug 2018  路  5Comments  路  Source: spring-cloud/spring-cloud-config

image

tag1. refreshes the common configuration for a single project, such as some constants, mappings, etc.

tag2. write component configuration for redis/datasource.

Since 1 tends to have a lot of k, v .then I don't confirm where the bean refresh, I have to choose refreshAll but this will refresh redis/datasource etc. But I don't want to refresh redis/datasource

I hope to consider adding the excloude("beanName") method to support it.

as follows:
refreshScope.refreshAll().exclude({'redis','datasource'});

enhancement help wanted

Most helpful comment

I'd like to see if there is more interest from the community

All 5 comments

hiyah, I haven't contributed to the repo before, but this one looks like a relatively easy change(?). Mind if I give it a shot?

I'd like to see if there is more interest from the community

@jtanza If you like, of course you can. It is an open source software like spring cloud config, but it will automatically detect the configuration changes and refresh the bean.

@spencergibb thanks.

I was going to apply this feature and notice that this feature will break backward compatibility.

  1. refreshScope.refreshAll().exclude({'redis','datasource'});: doesnt fit because #void refreshAll must return a builder in this case - breaking compatibility

  2. refreshScope.refreshAll(exclusions): it is possible but will lose consistency with RefreshScopeRefreshedEvent on every refresh call.

    RefreshScopeRefreshedEvent accepts a name or a default name __refreshAll__. We'll have to collect all the names to return it to RefreshScope object and it requires to add new method to interface ScopeCache - breaks compatibility. And this case will proceed a lot of events for every bean name, I think is not appropriate

I'd open a PR if the interface changes are worth it.

Was this page helpful?
0 / 5 - 0 ratings