Is there a way I could use Java -D arguments in application .properties file, such that when I load my properties, on a specific key-value, part of value is replaced with -D argument.
I have an app.properties file like this
example.file=file:/Users/XXXX/assets/tables/overage/test1.xls
example.template.file=file:/Users/XXXX/assets/tables/overage/test2.xls
example.mapping.file=file:/Users/XXXX/assets/tables/overage/test3.properties
I want to extract "file:/Users/XXXX/assets/tables/" to a -D argument to make my properties file independent of the server environment.
Example:
Jvm arg:
-Dfilepath="file:/Users/XXXX/assets/tables/"
I tried something like this
example.file={filepath}overage/test1.xls
so when I call below code and with some mechanism it should replace file path with environment variable.
Properties prop = new Properties();
FileInputStream fis = new FileInputStream(new File(app.properties))
prop.load(fis);