From 713d6a8d7358cb3a84c4bb73f7c74bf23389b253 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Mon, 26 Mar 2018 14:39:01 -0400 Subject: [PATCH] Document how to expose refresh endpoint (#346) * Document how to expose refresh endpoint. Fixes #343 --- docs/src/main/asciidoc/spring-cloud-commons.adoc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/spring-cloud-commons.adoc b/docs/src/main/asciidoc/spring-cloud-commons.adoc index f7e34598..a028c198 100644 --- a/docs/src/main/asciidoc/spring-cloud-commons.adoc +++ b/docs/src/main/asciidoc/spring-cloud-commons.adoc @@ -174,8 +174,19 @@ The `RefreshScope` is a bean in the context and has a public `refreshAll()` met The `/refresh` endpoint exposes this functionality (over HTTP or JMX). To refresh an individual bean by name, there is also a `refresh(String)` method. +To expose the `/refresh` endpoint, you need to add following configuration to your application: + +[source,yaml] +---- +management: + endpoints: + web: + exposure: + include: refresh +---- + NOTE: `@RefreshScope` works (technically) on an `@Configuration` class, but it might lead to surprising behavior. -For example, it does *not* mean that all the `@Beans` defined in that class are themselves in `@RefreshScope`. +For example, it does not mean that all the `@Beans` defined in that class are themselves in `@RefreshScope`. Specifically, anything that depends on those beans cannot rely on them being updated when a refresh is initiated, unless it is itself in `@RefreshScope`. In that case, it is rebuilt on a refresh and its dependencies are re-injected. At that point, they are re-initialized from the refreshed `@Configuration`).