Spring boot Spring云配置刷新配置
是否可以通过调用java方法来刷新配置以使用REST api:Spring boot Spring云配置刷新配置,spring-boot,spring-cloud-config,Spring Boot,Spring Cloud Config,是否可以通过调用java方法来刷新配置以使用REST api: curl localhost:8080/exactor/refresh-d{}-H“内容类型:application/json”您可以使用fromspring云上下文: @Autowired private RestartEndpoint restartEndpoint; ... Thread restartThread = new Thread(() -> restartEndpoint.restart()); rest
curl localhost:8080/exactor/refresh-d{}-H“内容类型:application/json”
您可以使用fromspring云上下文:
@Autowired
private RestartEndpoint restartEndpoint;
...
Thread restartThread = new Thread(() -> restartEndpoint.restart());
restartThread.setDaemon(false);
restartThread.start();
这就是如何做到这一点。但是请注意,SpringCloud文档还说,只要它们是RefreshScope,您就可以使用它们。谢谢。只是一个问题,为什么在线程中使用restartEndpoint?异步调用它()是有意义的,但我不确定您是否需要再这样做,因为它似乎已添加到v2中的底层代码中-