I am using Embedding the Config Server with release train Greenwich.SR3 https://cloud.spring.io/spring-cloud-config/multi/multi__embedding_the_config_server.html with configuration similiar in html link

spring:
  application:
    name: configserver
  profiles:
    active: composite
  cloud:
    config:
      server:
        composite:
          - type: native
            search-locations: ${HOME}/Desktop/config
        bootstrap: true

In my config-server application I am serving configuration based on profiles and labels. Request for configuration looked like this: http://localhost:8889/frontend-applicationwizard/local/testabn or http://localhost:8888/testabn/frontend-applicationwizard.yml

I transitioned my config-server app from spring boot 1 to spring boot 2

Bug report

After transitioning from spring boot 1 to spring boot 2, request for configuration based on labels stopped working.

I searched how the serachLocations is working in library and i found that, after upgrade NativeEnvironmentRepository does not call setSearchLocations(String... locations) method. As a result locations property of Locations class is being built String wrongly.

example of string after passing reuqest for http://localhost:8889/frontend-applicationwizard/local/testabn result :${HOME}/Desktop/configtestabn/ instead of ${HOME}/Desktop/config/testabn/

To repair issue as it stands today the property must be changed from search-locations: ${HOME}/Desktop/config to search-locations: ${HOME}/Desktop/config/ (adding last slash)

Enhancement Currently only AbstractScmEnvironmentRepository calls getLocations to repair wrongly set search-locations property in properties file.

In spring boot 1 NativeEnvironmentRepository was using @ConfigurationProperties annotation directly so setLocations method was called exactly as bean was built

In spring boot 2 to build NativeEnvironmentRepository bean, NativeEnvironmentProperties is used. As a result setSearchLocations method is never called if using NativeEnvironmentRepository directly

Comment From: spencergibb

Should be a fairly easy fix to call setSearchLocations() in the NativeEnvironmentRepository constructor.

PRs welcome.