Describe the bug When the native.search-locations share a path with config.additional-location, the property is not loaded properly. The client application only loads properties from classpath:/{application}/ in the below not working samples.

spring-cloud-config-server:2.2.2.RELEASE

Sample https://github.com/at2706/cloud-config-server-sample

bootstrap.properties working properly:

spring.cloud.config.server.native.search-locations=classpath:/common/,classpath:/{application}/
spring.config.additional-location=classpath:common/
spring.cloud.config.server.native.search-locations=classpath:common/,classpath:/{application}/
spring.config.additional-location=classpath:/common/

bootstrap.properties not working properly:

spring.cloud.config.server.native.search-locations=classpath:common/,classpath:/{application}/
spring.config.additional-location=classpath:common/
spring.cloud.config.server.native.search-locations=classpath:/common/,classpath:/{application}/
spring.config.additional-location=classpath:/common/

Comment From: spencergibb

what is "working properly"?

Comment From: at2706

The client application reads property files from both directories classpath:common and classpath/application-name.

Comment From: spencergibb

is this a regression or some behaviour that changed?

Comment From: at2706

I'm not sure what the behavior was in older versions. I don't think spring.config.additional-location should ever affect client applications though. It seems unintended.

Comment From: spencergibb

I'm sure this has always been the case with the native environment repository

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: typekpb

I might face the similar issue. I have 2 Microservices:config-server and config-client. In config-server I activated native profile. Both should share the same folder with configurations (${jboss.home.dir}/../../configuration):

application.yml
config-server.yml
config-client.yml

and set in (config-server.yml):

spring:
  cloud:
    config:
      server:
        native:
          searchLocations: file:${jboss.home.dir}/../../configuration

moreover in config-server/src/resources/bootstrap.yml:

  config:
    additional-location: file:${jboss.home.dir}/../../configuration
    name: application, config-server

That means: * config-server uses: ${jboss.home.dir}/../../configuration/config-server.yml and ${jboss.home.dir}/../../configuration/application.yml for it's configuration and config-client should use: ${jboss.home.dir}/../../configuration/config-client.yml and ${jboss.home.dir}/../../configuration/application.yml for it's configuration. BUT* it uses only ${jboss.home.dir}/../../configuration/config-client.yml

The root-cause seems to be implementation: https://github.com/spring-cloud/spring-cloud-config/blob/3d635f148870bd5f01be5e97c948bfe697d8e5d7/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/NativeEnvironmentRepository.java#L234 , that prevents using the same file for config-server and it's native repository files.

What would be the proper way to fix this? Or possibly workaround it on my side?

Comment From: spencergibb

Native config server is built to not ship it's configuration to clients. So anything in applciation.yml will not get sent.