Clarify how to make immutable beans refreshable. Fixes #363
This commit is contained in:
@@ -167,6 +167,12 @@ This feature addresses the problem of stateful beans that only get their configu
|
||||
For instance, if a `DataSource` has open connections when the database URL is changed via the `Environment`, you probably want the holders of those connections to be able to complete what they are doing.
|
||||
Then, the next time something borrows a connection from the pool, it gets one with the new URL.
|
||||
|
||||
Sometimes, it might even be mandatory to apply the `@RefreshScope`
|
||||
annotation on some beans which can be only initialized once. If a bean
|
||||
is "immutable", you will have to either annotate the bean with `@RefreshScope`
|
||||
or specify the classname under the property key
|
||||
`spring.cloud.refresh.extra-refreshable`.
|
||||
|
||||
Refresh scope beans are lazy proxies that initialize when they are used (that is, when a method is called), and the scope acts as a cache of initialized values.
|
||||
To force a bean to re-initialize on the next method call, you must invalidate its cache entry.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user