Skip to content

Instantly share code, notes, and snippets.

@ruoguluo
Created July 13, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruoguluo/d1d1a9932c65eddf7701 to your computer and use it in GitHub Desktop.
Save ruoguluo/d1d1a9932c65eddf7701 to your computer and use it in GitHub Desktop.
getProperty from properties file
public class PropertyLoader {
private static Properties prop;
private PropertyLoader() {
}
public static synchronized String getProperty(String propertyName) throws IOException {
if (prop == null) {
prop = new Properties();
InputStream in = PropertyLoader.class.getClassLoader().getResourceAsStream("local.properties");
prop.load(in);
in.close();
}
return (String) prop.get(propertyName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment