1
votes

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?

2
check the documentation- cloud.spring.io/spring-cloud-static/spring-cloud-config/… There is something called Spring Cloud Bus. I have never used it personally , so cant advise , but this fits what u want to do. - Indraneel Bende
Thanks, I'll look at it. - Yaroslav Lukianenko

2 Answers

1
votes

spring cloud bus introduced for refresh all the micro-services when we call to "/bus/refresh" endpoint. You try this by exposing "/refresh" endpoint

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();
}