spring-cloud / spring-cloud/spring-cloud-commons

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

Open
#1,116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LegacyContextRefresher in spring-cloud-context 3.1.1 and follow the ContextRefresher.refresh() path. Reproduce the change from two property sources to one, then verify that the removed source no longer contributes its value and that the remaining source still does.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.