Skip to content

Incorrect overriding of array property #1362

@disimo74

Description

@disimo74

You can skip this comment and go to the next.

Describe the bug

I have an application configured with a default profile and a custom profile, when a define a property in the default profile I cannot overwrite it in the custom profile.
I find this problem using the spring-cloud-kubernetes-configserver images 2.1.7 and 3.0.3

Sample

Referring the test class KubernetesEnvironmentRepositoryTests, in the tests setup there are a store and a store-dev configuration.
If a call environmentRepository.findOne("stores", "dev", "") it retrieves the properties sources in this order:

  • configmap.stores.default
  • configmap.stores.dev
  • configmap.application.default

so the store.default it's returned as first and the properties cannot be overridden by the dev profile.

I have not tested a multi-profile scenario, but I think the override should follow the order of the profile declaration.
For example if I configure the application with:
spring.profiles.active=dev1,dev2
dev2 should override the properties in dev1 and default.
In this example I expect the properties sources will be retrieved in this order:

  • configmap.stores.dev2
  • configmap.stores.dev1
  • configmap.stores.default
  • configmap.application.dev2
  • configmap.application.dev1
  • configmap.application.default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions