Spring Cloud Config Server - application.properties overriding profile properties

Viewed 14

I am trying to understand why a profile-specific property is overridden by the base application.properties within my Spring Cloud Config. I am using Spring Boot 2.4. Here is the minimal product reproducing the issue: github.com/semagnum/spring-config-server-poc-issue

Spring Cloud Config Client is enabled for my test app. When I call my config server, it retrieves a String array property:

{
  "name": "myapp",
  "profiles": [
    "dev"
  ],
  "propertySources": [
    {
      "name": "classpath:/myapp-dev.properties",
      "source": {
        "my.security.scope[0]": "api://MY_APP/.default"
      }
    },
    {
      "name": "classpath:/myapp.properties",
      "source": {
        "my.security.scope[0]": "default"
      }
    }
  ]
}

This string array property is not defined at all in the client's application files, no spring.cloud.config.override properties defined. When run and I retrieve the scope value, it returns "default", not dev's "api:MY_APP/.default". Why is it picking the non-dev one instead of the dev one, which I would expect to override it?

0 Answers
Related