One of our team has implemented loading properties this way (see pseudo code below) and advises this approach is right as the client application using this is free to keep t
You can put the properties in any file and still use PropertyPlaceholderConfigurer
. Here's an example that satisfies both your coworker's concerns and your desire for environment specific stuff:
classpath:MyCompany.properties
classpath:MyCompany.${mycompany.env:dev}.properties
classpath:${mycoworker}
file:///${user.home}/MyCompany.properties
If you pass in no -D
arguments, then you'll pick up the following properties files, where properties in the later files overwrite previously determined values.
To swap in a production config for #2, just pass -Dmycompany.env=prod
to java. Similarly your coworker can pass -Dmycoworker=/some/path/config.properties
if he/she wants.