Is it possible to read different property groups from a Java file, without manual processing?
By “manual” I mean reading the file line by line, detecting where the start of a property group is and then extracting the corresponding key-value pairs. In practice, this means reinventing (most of) the wheel that the Properties.load() method constitutes.
Essentially, what I am looking for is an easy way of reading, from a single file, multiple groups of properties, with each group being identifiable, so that it can be loaded in its own Java Properties object.
I you want to use
java.util.Propertiesyou can use prefixes. In .properties file:and read them like this:
and using:
You can also use ini4j with windows ini files.
Another, better way is using own, custom structured file (for example XML).