[Solved] How to handle configuration properties in Java [closed]


Leverage standard Java Properties class. Create a properties file, i.e. conf.properties and load it.

#conf.properties:
key=value

#code
Properties conf = new Properties();
conf.load(new FileInputStream(new File("conf.properties")));
conf.getProperty("key"); // returns "value"

solved How to handle configuration properties in Java [closed]