Reputation: 2556
I've got a properties configuration file with properties that have many values separated by commas. I want to put comments next to some of them, but it seems that this is not possible?
I want to be able to do something like this:
property: value1,\
value2,\
...
value44,\
value45,\
# value45 comment
...
value89,\ # another comment
value90
Clarification: I'm supplying the config to a web service I don't own, so I can't use one of the extensions to the properties format like bracket-properties
Upvotes: 9
Views: 7473
Reputation: 785058
Unfortunately, it's not possible as Java properties files can have only single line # comments
.
However, you might be aware that you can also define properties in xml format and the XML syntax will let you enter multi-line comments.
If you decide to give XML a chance then you will need to call Properties#loadFromXML(InputStream)
to load your XML property file.
Upvotes: 8
Reputation: 2234
This is not possible. A comment must appear on a line by itself, and it consists of optional white space followed by the "#"
or "!"
character, and then arbitrary text up to the end-of-line. You can find the full specification of Java Properties files in the Javadoc documentation for the load(java.io.Reader reader)
method of the java.util.Properties
class.
Upvotes: 1