I am not able to read child nodes of an application by using Spring Cloud Zookeeper configuration.
For simplicity, lets assume, i have named it as Myapplication, and the same name node i have created in Zookeeper under config (/config/Myapplication). I have created one property inside the node such as (/config/Myapplication/sample 1). So "sample" property i am able to access my application.
But Suppose if i have one child node under Myapplication (/config/Myapplication/Configuration config). Now, i need to access "config" property under the Configuration node thats not happening.
I tried accessing by below code in my application, But no luck :-
@Value("${Configuration/config: Default Child Node config}")
private String config;
Please Suggest some way to move forward from here.
in short, if you define node like this:
/config/<Your-App-Name>/consumerId 12345
you should to be able to access it like:
@Value(${consumerId})
private String consumeId
Note.- you can only define your variables as following:
/config/<Your-App-Name>/yourVar1 val1
/config/<Your-App-Name>/yourVar2 val2 ...etc
nodes defined as child of /config/ can be accessed easily by springboot.
more technical details here