Reputation: 658
I need to read config.properties
file from location that i set with variable -Dapp.conf=/path/to/config.properties
and set it to a Datasource when i launch my application.
file should be at any location within filesystem.
how to do this?
Upvotes: 1
Views: 1338
Reputation: 45005
You can load your properties
file as next:
Properties p = new Properties();
try (Reader reader = new FileReader(System.getProperty("app.conf"))) {
p.load(reader);
}
Once loaded you can use your properties
instance to set your datasource configuration.
Upvotes: 2