Skip to content

Instantly share code, notes, and snippets.

@r-deleon
Created May 26, 2015 01:47
Show Gist options
  • Save r-deleon/69fa8d34a2c15e917d34 to your computer and use it in GitHub Desktop.
Save r-deleon/69fa8d34a2c15e917d34 to your computer and use it in GitHub Desktop.
package ClasesBasicas;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
public class Config {
private static Properties config;
public static Properties getConfig() {
if (config == null) {
config = new Properties();
try {
config.load(new FileInputStream("config.properties"));
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
return config;
}
}
// Se usa de esta manera
Config.getConfig().getProperty("db-user");
alfresco-host=http://localhost:8081/alfresco
alfresco-username=admin
alfresco-password=admin
db-user=root
db-password=
@r-deleon
Copy link
Author

config.properties va en el root del proyecto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment