The way you have configured the property-placeholder
, any property you have in p2.properties
will take precedence over the ones in p1.properties
.
That is because the properties in last file always take precedence.
What you have setup is a standard way for SysAdmins or DevOps people to override properties of your application. You could for example have the first file be a classpath properties file while the second one could be like you have it, a file systems based properties file, whose values override the ones in the first.
If you check the JavaDoc of PropertiesLoaderSupport
(which handles the loading of the resources and is an abstract class that is extended by PropertySourcesPlaceholderConfigurer
) you will see that in the setLocations
method it has the following comment
Note: Properties defined in later files will override properties defined earlier files, in case of overlapping keys. Hence, make sure that the most specific files are the last ones in the given list of locations.