Document how to expose refresh endpoint (#346)
* Document how to expose refresh endpoint. Fixes #343
This commit is contained in:
@@ -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`).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user