Search code examples
spring-bootapplication.properties

What is the syntax of Spring Boot "application.properties" file?


I've seen different delimeters for properties : = Can't find reference about it.


Solution

  • In application.properties you can specify properties in either of these forms:

    • Using =:

      key=value

    • Using :

      key: value

    All examples in the Spring docs for application.properties use = as the delimiter. But Java properties also supports : so by extension Spring (which is utilising java.util.Properties under the hood also supports :. Here's the relevant extract from the java.util.Properties Javadoc ...

    The key contains all of the characters in the line starting with the first non-white space character and up to, but not including, the first unescaped '=', ':', or white space character other than a line terminator.