Reputation: 96
I use spring cloud config. Config server gets property from git repo. Client update own property only after I send post request to /refresh endpoint on client. How can I compel client refresh property after config server handle "change property" event?
Upvotes: 1
Views: 897
Reputation: 21
To reload config files of config server upon changing some parameter. For that you can try programmatic restart option. That can be done by closing the application context and creating a new context from scratch. That can be done in a following simple way.
public static void restart() {
ApplicationArguments args = context.getBean(ApplicationArguments.class);
Thread thread = new Thread(() -> {
context.close();
context = SpringApplication.run(Application.class, args.getSourceArgs());
});
thread.setDaemon(false);
thread.start();
}
Upvotes: 1
Reputation: 190
spring cloud bus introduced for refresh all the micro-services when we call to "/bus/refresh" endpoint. You try this by exposing "/refresh" endpoint
Upvotes: 1