Run Spring boot .jar file with spring.config.location with replace values of application.properties?

52
July 16, 2017, at 8:55 PM

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 ?

Answer 1

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.

READ ALSO
Understanding Apache Tomcat Connection Pooling

Understanding Apache Tomcat Connection Pooling

I am trying to implement Apache Tomcat's built-in JDBC connection poolBut I am confused with many things

31
how to disable only cut option on textview android

how to disable only cut option on textview android

I applied this code for Textview Selection

20
Change font of a JFoenix NumberValidator message

Change font of a JFoenix NumberValidator message

I want to change the font of a NumberValidator

20