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?
1
votes
2 Answers
1
votes
1
votes
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();
}