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

Simple Discovery properties does not respect user configuration

Open
#1,225 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

Describe the bug
I expect environment variables to be usable to configure simple discovery.
The loop initializing the serviceId in the configured simple service properties breaks user config if done [1].
Is it possible to change this loop logic ([1]) to set the service id if not set and if set ensure the key is the serviceId configured and not the deduced one with spring env->properties mapping logic which is easily wrong if the services use iphen in the name.

Sample
Not sure it is needed.

[1] https://github.com/spring-cloud/spring-cloud-commons/blob/main/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryProperties.java#L81

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 at spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryProperties.java around line 81, where the serviceId initialization loop is described. Trace how configured simple service properties are populated from environment variables, especially names containing hyphens. Done means configured service IDs are preserved and only unset IDs are deduced correctly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.