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

LegacyContextRefresher not removing a property source from the config client configuration when the property source has been removed from the config server

Open loaswaco opened this issue 3 years ago • 0 comments

Concerning LegacyContextRefresher in spring-cloud-context 3.1.1

When a config server configuration for an application "test" and active profile "local" changes from something like

{
  "name": "test",
  "profiles": [
	"local"
  ],
  "label": null,
  "version": null,
  "state": null,
  "propertySources": [
	{
	  "name": "test-local",
	  "source": {
		"some-property": "overridden"
	  }
	},
	{
	  "name": "classpath:/configuration/application-local.yml",
	  "source": {
		"some-property": "config-file"
	  }
	}
  ]
}

to something like

{
  "name": "test",
  "profiles": [
	"local"
  ],
  "label": null,
  "version": null,
  "state": null,
  "propertySources": [
	{
	  "name": "classpath:/configuration/application-local.yml",
	  "source": {
		"some-property": "config-file"
	  }
	}
  ]
}

the property "some-property" seems to retain the value "overriden" in the config client's configuration because the property source "test-local" that has been removed from the config server does not seem to get removed from the configuration of the config client upon context refresh via ContextRefresher.refresh().

There seems to be no code in LegacyContextRefresher that would handle such situations.

loaswaco avatar May 30 '22 14:05 loaswaco