Description
Spring Boot 2.4 will ship with support that allows you to easily import additional config files. There's a bit of background about the feature in this blog post. Currently the content-assist for spring.config.import
will be limited to the hints that we provide in the meta-data JSON file, but we might be able to go further.
The spring.config.import
key accepts a list of string location values. Locations are ultimately resolved to provide additional config data. The resolver logic is completely pluggable, but by convention a location prefix will be used to determine how the location is resolved.
Out of the box, we'll have support for configtree:
and resource:
. The resource:
prefix will also be used as the default of no other resolver supports the string.
Some examples:
spring.config.import=/etc/config/myfile.yml # import a file from the filesystem
#---
spring.config.import=resource:/etc/config/myfile.yml # more explicit version of above
#---
spring.config.import=classpath:extra.properties # import a classpath resource
#---
spring.config.import=resource:classpath:extra.properties # more explicit version of above
#---
spring.config.import=configtree:/etc/config/folder # import a config tree
It might be possible to offer some content-assist that would allow users to select files from either their workspace, or from their local disk. I suspect the workspace would be more useful.
For example:
The user types
spring.config.import=
Content assist could provide the usual hints:
+------------+
| classpath: |
| configtree:|
| file: |
+------------+
It could also provide a richer "select classpath resource..." option. This could bring up a dialog similar to "Open Resource". You could also have a "select filesystem resource..." option.
Another useful feature would be ctrl-click on a location.
For example, given:
spring.config.import=classpath:my.properties
A ctrl-click on classpath:my.properties
could open the my.properties
file.