Restrict wildcard pattern support for configuration files

This commit restricts how wildcards can be used in search
locations for property files. If a search location contains
a pattern, there must be only one '*' and the location should
end with a '*/'. For search locations that specify the file
name, the pattern should end with '*/<filename>'.

The list of files read from wildcard locations are now sorted
alphabetically according to the absolute path of the file.

Closes gh-21217
This commit is contained in:
Madhura Bhave
2020-04-30 13:08:48 -07:00
parent 080123ebeb
commit 8ec16bd027
4 changed files with 84 additions and 9 deletions

View File

@@ -499,7 +499,8 @@ For example, if you have some Redis configuration and some MySQL configuration,
This might result in two separate `application.properties` files mounted at different locations such as `/config/redis/application.properties` and `/config/mysql/application.properties`.
In such a case, having a wildcard location of `config/*/`, will result in both files being processed.
NOTE: Locations with wildcards are not processed in a deterministic order and files that match the wildcard cannot be used to override keys in the other.
NOTE: A wildcard location must contain only one `*` and end with `*/` for search locations that are directories or `*/<filename>` for search locations that are files.
Locations with wildcards are sorted alphabetically based on the absolute path of the file names.
[[boot-features-external-config-application-json]]