Is this a crappy solution?
@Singleton
@Lock(LockType.READ)
public class SystemProperties {
private final Properties properties = new Properties();
public SystemProperties() {
try (InputStream in =
this.getClass().getClassLoader().getResourceAsStream("system.properties")){
System.out.println("Read all properties from file");
properties.load(in);
} catch (IOException e) {
e.printStackTrace();
}
}
public String getProperty(String key) { return
properties.getProperty(key); }
public Set<String> getAllPropertyNames() { return
properties.stringPropertyNames(); }
public boolean containsKey(String key) { return
properties.containsKey(key); }
}
And then in a bean, inject this singleton ejb?
@Inject
private SystemProperties properties;
Is this a bad way to solution?
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/Total-noob-question-system-properties-tp4674263p4674265.html
Sent from the TomEE Users mailing list archive at Nabble.com.