configuration reader java

Solutions on MaxInterview for configuration reader java by the best coders in the world

showing results for - "configuration reader java"
Alia
27 Sep 2018
1public class ConfigurationReader {
2private static Properties properties;
3static {
4 try (FileInputStream fileInputStream = new FileInputStream("configuration.properties")) {
5            properties = new Properties();
6            properties.load(fileInputStream);
7 } catch (IOException e) {
8            e.printStackTrace();
9throw new RuntimeException("Unable to find configuration.properties file!");
10        }
11    }
12public static String getProperty(String key) {
13return properties.getProperty(key);