Currently our configtree:/... import support will create a flattened structure by replacing / with .. For example, configtree:/etc/config for the following:
etc/
config/
db/
password
mq/
password
Would add a db.password and mq.password properties.
This works well to prevent name clashes, but might be a problem if a user prefer to only use the filenames as properties. For example:
etc/
config/
mydbservice/
spring.datasource.password
mymqservice/
spring.mq.password
We should look at options that will help with the second case.
Comment From: philwebb
It strikes me that this is quite similar to the wildcard support that we already have for spring.config.location. Perhaps rather than adding an option to ConfigTreePropertySource we should instead add wildcard support so that multiple folders can be added quickly.
I.e., given
etc/
config/
mydbservice/
spring.datasource.password
mymqservice/
spring.mq.password
You could so spring.config.import=configtree:/etc/config/* and get two property sources. One for mydbservice containing spring.datasource.password and one for mymqservice containing spring.mq.password.
Comment From: mbhave
Adding the restrictions we have in place for the wildcard support so that we can consider the same ones for the config tree.
- The location cannot contain multiple wildcards.
- The wildcard must be at the end of the path.
- Locations with wildcard directories are restricted to one-level deep.
- Locations with wildcard directories are sorted alphabetically.