Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
 
PREVIOUS NEXT
Tagged: #configuration #reader #java
ADD COMMENT
Topic
Name
4+8 =