Skip to content

Commit

Permalink
eclipse#457 add a section to make dynamic config source more visible
Browse files Browse the repository at this point in the history
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
  • Loading branch information
Emily-Jiang committed Nov 22, 2019
1 parent edd25e2 commit e88605a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/src/main/asciidoc/configsources.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ public class ExampleYamlConfigSourceProvider

Please note that a single `ConfigSource` should be either registered directly or via a `ConfigSourceProvider`, but never both ways.

=== Dynamic ConfigSource
A dynamic ConfigSource is a `ConfigSource` where its content can be updated, such as updating a property name or value or adding or deleting config properties
from it. For the property lookup, the method `config.getValue()` or `config.getOptionalValue()` retrieves the up-to-date value.
Alternatively, for the injection style, the following lookup should be used to retrieve the up-to-date value.
[source, text]
----
@Inject
@ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100")
private javax.inject.Provider<Long> timeout;
----

=== Cleaning up a ConfigSource

If a `ConfigSource` implements the `java.lang.AutoCloseable` interface then the `close()` method will be called when the underlying `Config` is being released.
Expand Down

0 comments on commit e88605a

Please sign in to comment.