Reputation: 65
When I run a Spring boot application from command line with --spring.config.location=another.properties
, values in another.properties
will be overridden the values in application.properties
?
For example:
If there is a value spring.datasource.url
in application.properties
, but not in application.properties
. So the value is taken from another.properties
or undefined ?
Upvotes: 0
Views: 3340
Reputation: 131346
It replaces.
The documentation states :
If you don’t like application.properties as the configuration file name you can switch to another by specifying a spring.config.name environment property. You can also refer to an explicit location using the spring.config.location environment property (comma-separated list of directory locations, or file paths).
Now, nobody prevents you from declaring multiple properties in spring.config.location
value :
$ java -jar myproject.jar --spring.config.location=classpath:/application.properties,classpath:/another.properties
In this way, another.properties
overrides properties also present in application.properties
.
Upvotes: 2