20 lines
432 B
Java
20 lines
432 B
Java
package singleton;
|
|
public class AppConfig {
|
|
|
|
private AppConfig() {
|
|
System.out.println("Reading configuration from file...");
|
|
}
|
|
|
|
private static class Holder {
|
|
static final AppConfig INSTANCE = new AppConfig();
|
|
}
|
|
|
|
public static AppConfig getInstance() {
|
|
return Holder.INSTANCE;
|
|
}
|
|
|
|
public String getProperty(String key) {
|
|
return System.getProperty(key, "(not set)");
|
|
}
|
|
}
|