1

I try to use Consul as configuration server with Spring boot. I already succeed to use the kv store of consul to fetch variables, but now I want to be able to fetch variables as YAML files. Here is my bootstrap.yaml :

spring:
  cloud.consul:
    host: localhost
    port: 8500
    config:
      enabled: true
      format: YAML
      failFast: true

I put this config on consul on the path "/config/my.application.name/data" :

testspring: hello

And I try to reach this property using :

@Value("${testspring}")

... with no success. What am I missing here ? What is the good path for config on consul ?

Thanks

EDIT : It appears that the config is loaded on the value ${data} and that it is not parsed. The data="testspring: hello", which is not what is expected.

Oreste Viron
  • 3,592
  • 3
  • 22
  • 34

1 Answers1

1

I was able to fetch data using your sample. But if I remove format: YAML (so use default KEY_VALUE) from my config then not parsed data property is fetched. Maybe double check your bootstrap.yml config for correct indentations.

What version of Spring Boot and Spring Cloud you are using ?

nmyk
  • 1,582
  • 1
  • 8
  • 20