Skip to content

Instantly share code, notes, and snippets.

@ssinganamalla
Created January 12, 2016 23:15
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 ssinganamalla/b00da073da999f290ef4 to your computer and use it in GitHub Desktop.
Save ssinganamalla/b00da073da999f290ef4 to your computer and use it in GitHub Desktop.
Load config properties file located in resources directory
public static ApplicationProperties loadProperties() {
Properties prop = new Properties();
InputStream input = null;
try {
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
input = classloader.getResourceAsStream("config.properties");
// load a properties file
prop.load(input);
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return new ApplicationProperties(prop);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment