Like any other file extensions, Comments are allowed specific to related language providers.
comments always start in a new line with space followed by
! character and followed by comments text.
java properties files support single-line comments only.
Properties commands do not support following
- Inline comments are allowed
- Block comments are not supported Comments format can be represented in two formats
One is using the Semicolon symbol
; placed at beginning of each line followed by comment text.
Another way is to use the hash symbol
# for key and value pair comments. hashing syntax only supports some of the implementations and space after the # symbol is recommended.
- Comments must prefix semicolon followed by space
- Comments must be single line only and closed
Here is a syntax
# comments text key= value
Comments text are not processed or interpreted by programming languages
Properties comments example
Let’s see the sample properties file with inline comments declared
# database to use database=mysql ;# inline comments
# environment of an application environment=production
Java properties support multi-line comments?
Java properties support single-line comments which start with a newline followed by the
Any text that starts with # symbol \ is ignored by the java compiler when reading the properties files.
Does java properties supports inline comments.
Java properties do not support inline comments.
Some languages have support for inline comments in properties files
How do you comment on application.properties in the Spring boot application?
Spring boot is a java application, so We can write single-line comments that start with the
# symbol followed by a comment string.
# this is a comment database=mysql