configuration reader java code example
Example: configuration reader java
public class ConfigurationReader {
private static Properties properties;
static {
try (FileInputStream fileInputStream = new FileInputStream("configuration.properties")) {
properties = new Properties();
properties.load(fileInputStream);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Unable to find configuration.properties file!");
}
}
public static String getProperty(String key) {
return properties.getProperty(key);