spring-cloud-config icon indicating copy to clipboard operation
spring-cloud-config copied to clipboard

Problem of overrides ordering with spring.config.import

Open mehdikhelif opened this issue 1 year ago • 0 comments

Describe the bug When updating to spring boot 3.2.5 and spring cloud 2023.0.1, we discovered that ordering of property sources was not anymore the same. We are using overrides to "enforce" some configurations shared across multiple microservices. So we are expecting overrides to always have precedence over configuration declared by any microservice.

Since commit https://github.com/spring-cloud/spring-cloud-config/commit/6ec9c432cb2c02840b85fdd8bcd0859eabc0ba46 , the overrides can be overridden by services configuration.

So if we have for example a service with default configuration file and profile 'dev' activated, we used to have this order of property sources:

  1. overrides
  2. service-dev.yaml
  3. service.yaml
  4. classpath: application.yaml

Now, after the update we have this:

  1. service-dev.yaml
  2. service.yaml
  3. overrides
  4. classpath: application.yaml

This is quite similar to the problem exposed in this ticket : https://github.com/spring-cloud/spring-cloud-config/issues/2392

The workaround proposed in the ticket works so using bootstrap starter kind of solves the issue. However, we have the feeling that this is not aligned with the documentation.

mehdikhelif avatar May 23 '24 11:05 mehdikhelif