Like any other file extensions, Comments are allowed with specific to related language provider.

comments always starts in new line with space followed by # or ! character and followed by comments text.

java properties files supports single line comments only.

Properties commands does not support following

  • InLine comments are allowed
  • Block comments are not supported Comments format can be represented in two formats

One is using Semicolon symbol ; placed at beginning of each line followed by comment text. Other way to use hash symbol # for key and value pair comments. hashing syntax only supports some of implementations and space after # symbol is recommended.

Important rules

  • Comments must prefix semicolon followed by space
  • Comments must be single line only and closed

Here is an syntax

# comments text

key= value

Comments text are not processed or interpreted by programming languages

Properties comments example

Let’s see 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 supports single line comments which starts with new line followed by # symbol.

Any text starts with # symbol are ignored by java compiler when reading the properties files.

Does java properties supports inline comments.

Java properties does not supports inline comments.

Some languages has a support for inline comments in properties files

How do you comment on application.properties in Spring boot application?

Spring boot is an java application, so We can write single line comments that starts with # symbol followed by comment string

Application.properties

# this is a comment
database=mysql