ConfigTreePropertySource

PropertySource backed by a directory tree that contains files for each value. The PropertySource will recursively scan a given source directory and expose a property for each file found. The property name will be the filename, and the property value will be the contents of the file.

Directories are only scanned when the source is first created. The directory is not monitored for updates, so files should not be added or removed. However, the contents of a file can be updated as long as the property source was created with a ALWAYS_READ option. Nested directories are included in the source, but with a '.' rather than '/' used as the path separator.

Property values are returned as Value instances which allows them to be treated either as an InputStreamSource or as a CharSequence. In addition, if used with an Environment configured with an ApplicationConversionService, property values can be converted to a String or byte[].

This property source is typically used to read Kubernetes configMap volume mounts.

Author

Phillip Webb

Since

2.4.0

Constructors

Link copied to clipboard
constructor(name: String, sourceDirectory: Path)
Create a new ConfigTreePropertySource instance.
constructor(name: String, sourceDirectory: Path, options: Array<ConfigTreePropertySource.Option>)
Create a new ConfigTreePropertySource instance.

Types

Link copied to clipboard
enum Option
Property source options.
Link copied to clipboard
A value returned from the property source which exposes the contents of the property file.

Functions

Link copied to clipboard
Link copied to clipboard
open fun equals(other: Any): Boolean
Link copied to clipboard
open fun getName(): String
Link copied to clipboard
open fun getOrigin(name: String): Origin
Return the origin of the given key or null if the origin cannot be determined.
open fun <K> getOrigin(source: Any, key: K): Origin
Attempt to look up the origin from the given source.
Link copied to clipboard
open fun getPrefix(): String
Return the implicit prefix that is applied when performing a lookup or null if no prefix is used.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getSource(): T
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun isImmutable(): Boolean
Return true if this lookup is immutable and has contents that will never change.
Link copied to clipboard
open fun named(name: String): PropertySource<out Any>
Link copied to clipboard
open fun toString(): String