Skip to content

ConfigDataLocationNotFoundException thrown at application startup with configserver: config imports, that are not even meant for the current profile #24584

@dnijssen

Description

@dnijssen

Since upgrading from 2.4.0 to 2.4.1 (same for 2.4.2-SNAPSHOT) my application fails to startup due the following exception;

  • Using Spring Cloud version 2020.0.0-RC1
06:46:34.776 [main] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.context.config.ConfigDataLocationNotFoundException: Config data location 'configserver:https://prod-configuration-server.org' cannot be found
	at org.springframework.boot.context.config.ConfigDataEnvironment.checkMandatoryLocations(ConfigDataEnvironment.java:360)
	at org.springframework.boot.context.config.ConfigDataEnvironment.applyToEnvironment(ConfigDataEnvironment.java:313)
	at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:233)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)

I think this is originally caused by improvements made in 3dc03ac

This occurs with the following setup; (starting up with both default profile as the local profile (-Dspring.profiles.active=local)

spring:
  application:
    name: foobar
  profiles:
    active: local

---

spring:
  config:
    activate:
      on-profile: local, docker
    import: configserver:http://localhost:8888

---

spring:
  config:
    activate:
      on-profile: dev, test
    import: configserver:https://test-configuration-server.org

---

spring:
  config:
    activate:
      on-profile: acc
    import: configserver:https://acc-configuration-server.org

---

spring:
  config:
    activate:
      on-profile: prd
    import: configserver:https://prod-configuration-server.org

In my understanding this exception is thrown because all mandatory locations are checked, and not just one from the active profile. I would expect it to nicely skip the configserver: imports for both dev, test, acc, prd in the above example. Even though they are not optional, they are not meant for the active profile either.

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions