Last updated
Properties File Syntax Reference
- Key-value separator:
=or:(both are valid) - Comments: Lines starting with
#or! - Multi-line values: End line with
\(backslash continuation) - Special characters: Escape with
\— e.g.,\n(newline),\t(tab),\\(backslash) - Unicode escapes:
\uXXXXfor non-ASCII characters - Whitespace: Leading whitespace in values is trimmed; use
\to preserve it - Empty values:
key=is valid — the value is an empty string
Examples
Example 1: Basic Properties File Format
# application.properties — Spring Boot configuration
# Server settings
server.port=8080
server.servlet.context-path=/api
# Database configuration
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=dbuser
spring.datasource.password=secret
# JPA settings
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
# Logging
logging.level.root=INFO
logging.level.com.example=DEBUG
logging.file.name=logs/application.log
Example 2: Tabular Editor View
The editor displays properties in a clean table format:
Key Value
─────────────────────────────────────────────────────────────
server.port 8080
server.servlet.context-path /api
spring.datasource.url jdbc:postgresql://...
spring.datasource.username dbuser
spring.datasource.password ••••••• (masked)
spring.jpa.hibernate.ddl-auto update
spring.jpa.show-sql false
logging.level.root INFO
logging.level.com.example DEBUG
Sort: Alphabetical ▼ | Filter: [spring.jpa...] | + Add Property
Example 3: Internationalization (i18n) Resource Bundles
# messages_en.properties (English)
app.title=My Application
app.welcome=Welcome, {0}!
app.error.notfound=Page not found
app.error.unauthorized=You are not authorized to view this page
button.save=Save
button.cancel=Cancel
button.delete=Delete
# messages_de.properties (German)
app.title=Meine Anwendung
app.welcome=Willkommen, {0}!
app.error.notfound=Seite nicht gefunden
app.error.unauthorized=Sie sind nicht berechtigt, diese Seite anzuzeigen
button.save=Speichern
button.cancel=Abbrechen
button.delete=Löschen
# messages_fr.properties (French)
app.title=Mon Application
app.welcome=Bienvenue, {0} !
app.error.notfound=Page non trouvée
app.error.unauthorized=Vous n'êtes pas autorisé à voir cette page
button.save=Enregistrer
button.cancel=Annuler
button.delete=Supprimer