Tanmay
Tanmay

Reputation: 404

Spring cloud config properties not honouring config properties

I wish to use consul strictly as a config source. I am using spring-cloud-consul-config to get my config. I am using git2consul to load files into consul and read them. As per the spring cloud documentation I have added the following to my build.gradle

compile ("org.springframework.cloud:spring-cloud-starter-consul-config")

and have the following in my application.properties

spring.application.name=test-service
spring.cloud.consul.config.enabled=true
spring.cloud.consul.enabled=true
spring.cloud.consul.config.format=FILES

The problem I am facing is that the expected properties are not being loaded into the ConfigurationProperties beans. On further debugging in the ConsulPropertySourceLocator::locate(Environment environment) method, I see that the this.properties object is still loaded with KEY_VALUE enum.

This led me to ConsulConfigBootstrapConfiguration class, where the ConsulConfigProperties bean is being instantiated using a constructor.

Is this the problem or do I have something wrong in my setup. If someone has a working setup of git2consul and spring cloud config, please can you point me to it for reference.

Upvotes: 2

Views: 575

Answers (1)

spencergibb
spencergibb

Reputation: 25157

These values that you have in application.properties

spring.application.name=test-service
spring.cloud.consul.config.enabled=true
spring.cloud.consul.enabled=true
spring.cloud.consul.config.format=FILES

need to be in bootstrap.properties.

Upvotes: 1

Related Questions