Search code examples
springspring-boot-configuration

Spring boot config client properties


//This is the value of the property which needs to be fetched via config server from git repo
ConfigClientController(@Value("**${foo:test}"**) String value) {
    this.value = value;
}

The above code is a spring cloud config client(spring.application.name=foo) that gets the config properties from the git config repo. Foo is the property in foo.properties. Here I am little confused about the :test param in the code above. I wanted to know what is the significance of this param in getting the property.


Solution

  • If foo parameter is not present meaning it cannot be obtained from the config test string will be used instead. Meaning - what's after the : is a default value for the @Value annotated param.