Fabry
Fabry

Reputation: 1650

Spring Cloud Config refresh configurations

Is it possible to refresh the configurations calling a java method instead to use the REST api:

curl localhost:8080/actuator/refresh -d {} -H "Content-Type: application/json"

Upvotes: 2

Views: 686

Answers (1)

Ryan Dawson
Ryan Dawson

Reputation: 12538

You can use the ResartEndpoint class from spring-cloud-context:

@Autowired
private RestartEndpoint restartEndpoint;

...

Thread restartThread = new Thread(() -> restartEndpoint.restart());
restartThread.setDaemon(false);
restartThread.start();

This is how @alexbt suggests to do it. But note that the spring cloud documentation also says you can refresh individual beans provided they are RefreshScope.

Upvotes: 2

Related Questions