Rename volumemount -> configtree
Closes gh-22941
This commit is contained in:
@@ -675,7 +675,7 @@ Locations will be processed in the order that they are defined, with later impor
|
||||
[TIP]
|
||||
====
|
||||
Spring Boot includes pluggable API that allows various different location addresses to be supported.
|
||||
By default you can import Java Properties, YAML and volume mounts.
|
||||
By default you can import Java Properties, YAML and "`<<boot-features-external-config-files-configtree, configuration trees>>`".
|
||||
|
||||
Third-party jars can offer support for additional technologies (there's no requirement for files to be local).
|
||||
For example, you can imagine config data being from external stores such as Consul, Apache ZooKeeper or Netflix Archaius.
|
||||
@@ -685,8 +685,8 @@ If you want to support your own locations, see the `ConfigDataLocationResolver`
|
||||
|
||||
|
||||
|
||||
[[boot-features-external-config-files-voumemounts]]
|
||||
==== Using Volume Mount Properties
|
||||
[[boot-features-external-config-files-configtree]]
|
||||
==== Using Configuration Trees
|
||||
When running applications on a cloud platform (such as Kubernetes) you often need to read config values that the platform supplies.
|
||||
It's not uncommon to use environment variables for such purposes, but this can have drawbacks, especially if the value is supposed to be kept secret.
|
||||
|
||||
@@ -696,10 +696,10 @@ For example, Kubernetes can volume mount both https://kubernetes.io/docs/tasks/c
|
||||
There are two common volume mount patterns that can be use:
|
||||
|
||||
. A single file contains a complete set of properties (usually written as YAML).
|
||||
. Multiple files are written to a directory with the filename becoming the '`key`' and the contents becoming the '`value`'.
|
||||
. Multiple files are written to a directory tree, with the filename becoming the '`key`' and the contents becoming the '`value`'.
|
||||
|
||||
For the first case, you can import the YAML or Properties file directly using `spring.config.import` as described <<boot-features-external-config-files-importing,above>>.
|
||||
For the second case, you need to use the `volumemount:` prefix so that Spring Boot knows it needs to expose all the files as properties.
|
||||
For the second case, you need to use the `configtree:` prefix so that Spring Boot knows it needs to expose all the files as properties.
|
||||
|
||||
As an example, let's imagine that Kubernetes has mounted the following volume:
|
||||
|
||||
@@ -718,12 +718,12 @@ To import these properties, you can add the following to your `application.prope
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.config.import=volumemount:/etc/config
|
||||
spring.config.import=configtree:/etc/config
|
||||
----
|
||||
|
||||
You can then access or inject `myapp.username` and `myapp.password` properties from the `Environment` in the usual way.
|
||||
|
||||
TIP: Volume mounted values can be bound to both string `String` and `byte[]` types depending on the contents expected.
|
||||
TIP: Configuration tree values can be bound to both string `String` and `byte[]` types depending on the contents expected.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user