The “spring.config.import” property is used in Spring Boot applications to import external configuration files. By default, Spring Boot looks for an application.properties or application.yml file in the classpath to load the configuration values.
However, if you want to import additional configuration files, you can use the “spring.config.import” property. This property should point to a file or multiple files that contain additional configuration properties.
Here’s an example of how to use the “spring.config.import” property in an application.properties file:
spring.config.import=file:/path/to/external.properties
In the above example, the “external.properties” file located at “/path/to” will be imported and its properties will be added to the overall application configuration.
You can also specify multiple files using a comma-separated list:
spring.config.import=file:/path/to/external1.properties,file:/path/to/external2.properties
In this case, both “external1.properties” and “external2.properties” files will be imported and their properties will be merged with the main configuration.
Note that the “spring.config.import” property can also be used with additional formats such as YAML. For example:
spring.config.import=classpath:/external.yml
In this case, the “external.yml” file located in the classpath will be imported as YAML configuration.
It’s worth mentioning that the “spring.config.import” property is optional, and if not specified, Spring Boot will only use the default configuration files (application.properties/yaml) found in the classpath.