0

I have a @Configuration class like below. I need to initialize configs from zookeeper znode's values on start of spring boot application and update config variables dynamically whenever their value gets updated in zookeeper.

@Component
@ConfigurationProperties("prefix")
class Props {
    
    private String property1;
    private String property2;

    // getters & setters...

}

application.properties

prefix.property1=${PROPERTY1}
prefix.property2=${PROPERTY2}

bootstrap.properties

spring.cloud.zookeeper.connectString=localhost:2181    
spring.cloud.zookeeper.config.watcher.enabled=true

The value of zNodes on zookeeper.

/config/application-name/context/property1: p1
/config/application-name/context/property2: p2

Not able to find any docs which defines how to bind the znode values to the config values in spring-boot application.

tusharRawat
  • 719
  • 10
  • 24

0 Answers0