spring-cloud / spring-cloud/spring-cloud-config

Including profiles with the spring.profiles.include property is not working for the jdbc environment

Open
#2,120 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

Describe the bug
Spring cloud version: 2021.0.1
When trying to include profiles with the spring.profiles.include property for the jdbc spring cloud config environment the profile is not included.

Sample
I have the following properties table for the jdbc spring cloud config profile:

application profile label key value
application myprofile master my-profile-variable my-profile-value
myapp default master spring.profiles.include myprofile

Right now when I call the config service to fetch the config for myapp with /myapp/default I get the following reponse:

{
  "name": "myapp",
  "profiles": [
    "default"
  ],
  "label": null,
  "version": null,
  "state": null,
  "propertySources": [
    {
      "name": "myapp-default",
      "source": {
        "spring.profiles.include": "myprofile"
      }
    }
  ]
}

But I would expect to get the following:

{
  "name": "myapp",
  "profiles": [
    "default"
  ],
  "label": null,
  "version": null,
  "state": null,
  "propertySources": [
    {
      "name": "application-myprofile",
      "source": {
        "my-profile-property": "my-profile-value"
      }
    },
    {
      "name": "myapp-default",
      "source": {
        "spring.profiles.include": "myprofile"
      }
    }
  ]
}

This works well with the Git backend.

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 the config service endpoint for /myapp/default and trace how the JDBC environment handles spring.profiles.include. Compare that behavior with the Git backend, using the supplied property table and response as the reproduction. Done means the JDBC response includes the application-myprofile property source and its my-profile-property value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.