Search code examples
javaspring-bootspring-cloudspring-cloud-configspring-config

Spring cloud server returning empty configurations


I have a dead simple config server with following properties :

spring:
    profiles:
        active: native
    cloud:
        config:
            server:
                native:
                    searchLocations: classpath:/configs
server:
    port: 8888

In the src/main/resources folder i have a configs folder with a customer-service.yml file inside it containing the following config :

spring:
    application:
        name: customer-service
    h2:
        console:
            enabled: true
server:
    port: 8080
eureka:
    client:
        serviceUrl:
            defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
    instance:
        preferIpAddress: true
        leaseRenewalIntervalInSeconds: 1
        leaseExpirationDurationInSeconds: 2
logging:
    level:
        com.netflix: WARN

The config server starts with no issue but issuing the following URL in the browser - http://localhost:8888/customer-service/master - returns the following response :

{"name":"customer-service","profiles":["master"],"label":null,"version":null,"state":null,"propertySources":[]}

There doesn't seem to be many examples out there of using a folder on the classpath to store configs. What am I doing wrong?


Solution

  • I just tried it with Spring 2.1.3 and it works as you have laid it out. Since you mentioned you are using Spring 2.2, there might have been a change or potentially a bug.

    Update

    Just for kicks, I tried it with 2.2.0.BUILD-SNAPSHOT and it works as well. Not sure what to say at this point.