类 ConfigTreePropertySource
- 所有已实现的接口:
OriginLookup<String>
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
ConfigTreePropertySource.Option.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 ConfigTreePropertySource.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.
- 从以下版本开始:
- 2.4.0
- 作者:
- Phillip Webb
-
嵌套类概要
嵌套类修饰符和类型类说明static enum
Property source options.static interface
A value returned from the property source which exposes the contents of the property file.从类继承的嵌套类/接口 org.springframework.core.env.PropertySource
PropertySource.StubPropertySource
-
字段概要
从类继承的字段 org.springframework.core.env.PropertySource
logger, name, source
-
构造器概要
构造器构造器说明ConfigTreePropertySource
(String name, Path sourceDirectory) Create a newConfigTreePropertySource
instance.ConfigTreePropertySource
(String name, Path sourceDirectory, ConfigTreePropertySource.Option... options) Create a newConfigTreePropertySource
instance. -
方法概要
修饰符和类型方法说明Return the origin of the given key ornull
if the origin cannot be determined.getProperty
(String name) String[]
boolean
Returntrue
if this lookup is immutable and has contents that will never change.从类继承的方法 org.springframework.core.env.EnumerablePropertySource
containsProperty
从类继承的方法 org.springframework.core.env.PropertySource
equals, getName, getSource, hashCode, named, toString
从接口继承的方法 org.springframework.boot.origin.OriginLookup
getPrefix
-
构造器详细资料
-
ConfigTreePropertySource
Create a newConfigTreePropertySource
instance.- 参数:
name
- the name of the property sourcesourceDirectory
- the underlying source directory
-
ConfigTreePropertySource
public ConfigTreePropertySource(String name, Path sourceDirectory, ConfigTreePropertySource.Option... options) Create a newConfigTreePropertySource
instance.- 参数:
name
- the name of the property sourcesourceDirectory
- the underlying source directoryoptions
- the property source options
-
-
方法详细资料
-
getPropertyNames
- 指定者:
getPropertyNames
在类中EnumerablePropertySource<Path>
-
getProperty
- 指定者:
getProperty
在类中PropertySource<Path>
-
getOrigin
从接口复制的说明:OriginLookup
Return the origin of the given key ornull
if the origin cannot be determined.- 指定者:
getOrigin
在接口中OriginLookup<String>
- 参数:
name
- the key to lookup- 返回:
- the origin of the key or
null
-
isImmutable
public boolean isImmutable()从接口复制的说明:OriginLookup
Returntrue
if this lookup is immutable and has contents that will never change.- 指定者:
isImmutable
在接口中OriginLookup<String>
- 返回:
- if the lookup is immutable
-