Reputation: 457
I am using ZooKeeper with spring boot. And In application.properties file I am using below properties as shown below.
minio.url=${minio.connection-string}
minio.access.key=${minio.accesskey}
where minio.connection-string and minio.accesskey value will be came from ZooKeeper znode data. I am using minio.url and minio.access.key in other Spring boot bean as shown below.
@Configuration
@RefreshScope
public class MinioClientConf
{
@Value("${minio.url}")
private String minioUrl;
@Value("${minio.access.key}")
private String minioKey;
.
.
When I start my spring boot application then all stuff works but when I change ZooKeeper node value then it is not reflecting in bean value without re-starting server. My problem is that I want to reload latest zookeeper value without re-starting server. I have also tried with refresh scope annotation but it didn't work.
Upvotes: 1
Views: 877
Reputation: 709
Instead of that use @ConfigurationProperties
@ConfigurationProperties("minio")
public class MinioClientConf
{
private String minioUrl;
private String minioKey;
.
.
For more details click here
Upvotes: 0