Skip to content

Unable to provide different values of spring.config.import.configserver since 2020.0.4 #2011

@harshadloya

Description

@harshadloya

Describe the bug
Spring Cloud version = 2020.0.4+

Issue
When providing multiple values as list for config server url, the last URL is only used.
The call is also tried 4 times because 4 imports have been provided.
My expectation is at any time only 1 of the 4 placeholders will have value and the springboot app will be automatically be able to use that to call the config server of that environment level.

Sample
Providing configuration in application.yml

spring:
  config:
    import:
      - optional:configserver:\${vcap.services.config-service-development.credentials.uri}
      - optional:configserver:\${vcap.services.config-service-integration.credentials.uri}
      - optional:configserver:\${vcap.services.config-service-volume.credentials.uri}
      - optional:configserver:\${vcap.services.config-service-production.credentials.uri}

Logs:
{"timestamp":"2021-12-07T15:43:14.969Z","msg":"The following profiles are active: local","logger":"c.l.MyApplication","thread":"main","level":"INFO","app":"my-app}
{"timestamp":"2021-12-07T15:43:15.015Z","msg":"Could not locate PropertySource ([ConfigServerConfigDataResource@fff25f1 uris = array['\${vcap.services.config-service-production.credentials.uri}'], optional = true, profiles = list['local']]): Invalid URL: \${vcap.services.config-service-production.credentials.uri}","logger":"o.s.b.c.c.ConfigDataLoader","thread":"main","level":"WARN","app":"my-app"}}
{"timestamp":"2021-12-07T15:43:15.015Z","msg":"Could not locate PropertySource ([ConfigServerConfigDataResource@263f04ca uris = array['\${vcap.services.config-service-production.credentials.uri}'], optional = true, profiles = list['local']]): Invalid URL: \${vcap.services.config-service-production.credentials.uri}","logger":"o.s.b.c.c.ConfigDataLoader","thread":"main","level":"WARN","app":"my-app"}}
{"timestamp":"2021-12-07T15:43:15.015Z","msg":"Could not locate PropertySource ([ConfigServerConfigDataResource@2ca47471 uris = array['\${vcap.services.config-service-production.credentials.uri}'], optional = true, profiles = list['local']]): Invalid URL: \${vcap.services.config-service-production.credentials.uri}","logger":"o.s.b.c.c.ConfigDataLoader","thread":"main","level":"WARN","app":"my-app"}}
{"timestamp":"2021-12-07T15:43:15.015Z","msg":"Could not locate PropertySource ([ConfigServerConfigDataResource@5a021cb9 uris = array['\${vcap.services.config-service-production.credentials.uri}'], optional = true, profiles = list['local']]): Invalid URL: \${vcap.services.config-service-production.credentials.uri}","logger":"o.s.b.c.c.ConfigDataLoader","thread":"main","level":"WARN","app":"my-app"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions