-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfigLoader.java
More file actions
24 lines (20 loc) · 792 Bytes
/
Copy pathConfigLoader.java
File metadata and controls
24 lines (20 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.Miniproject;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class ConfigLoader {
private static final Properties properties = new Properties();
/* loads the db_urls and table names from the config.properties file should be
kept in the same working directory of the application */
static {
try (InputStream input = new FileInputStream("config.properties")) {
properties.load(input);
} catch (IOException e) {
throw new RuntimeException("Failed to load config.properties from application folder", e);
}
}
public static String getProperty(String key) {
return properties.getProperty(key);
}
}