Featured Article

Spring Boot application.properties Tutorial: The Ultimate Guide to Configuration

Kenneth Jul 13, 2026

Embarking on your Spring Boot adventure?spring boot application.properties tutorial

How to use Environment Variables in Spring Boot
How to use Environment Variables in Spring Boot

Excellent! This essential file allows you to externalize your application's configuration, making it easier to manage and maintain. Let's dive in and explore how to use it.

Spring Boot Tutorial
Spring Boot Tutorial

The application.properties File

The application.properties file is where you'll house your properties, following the key=value format. It resides in the src/main/resources directory of your Spring Boot project.

Spring Boot MongoDB Java Tutorial With Examples - JavaTechOnline
Spring Boot MongoDB Java Tutorial With Examples - JavaTechOnline

Spring Boot automatically loads the application.properties file when you start your application, making your configuration readily available.

Property Prefixes

Spring Boot: The Common Application Properties You NEED to Know
Spring Boot: The Common Application Properties You NEED to Know

You can use prefixes to categorize your properties. For example:

my.app.name=MyApp
my.app.version=1.0.0

The my.app prefix helps keep your properties organized.

Property Types

Spring Boot Application Properties Example - Java Code Geeks
Spring Boot Application Properties Example - Java Code Geeks

Spring Boot infers the property type based on the value's format. For example:

server.port=8080
my.app.datetime=2022-03-14T12:34:56
my.app.enabled=true

Here, the server.port property is an integer, my.app.datetime is a Date, and my.app.enabled is a boolean.

Using Default Profiles

Spring Boot Logging: Log4j2 Configuration Made Simple
Spring Boot Logging: Log4j2 Configuration Made Simple

Default profiles allow you to manage environments seamlessly. To set a default profile:

application.properties

Spring Boot Project Ideas for Resume | Real-World Examples
Spring Boot Project Ideas for Resume | Real-World Examples
Spring Boot: Custom Ports Made Easy
Spring Boot: Custom Ports Made Easy
Spring Boot: The Common Application Properties You NEED to Know
Spring Boot: The Common Application Properties You NEED to Know
Spring Boot: Changing the Default Context Path (and why you should)
Spring Boot: Changing the Default Context Path (and why you should)
Difference between application.properties vs Application.json vs Application.yml in Spring Boot
Difference between application.properties vs Application.json vs Application.yml in Spring Boot
How to access configuration values from application.properties file in Spring Boot? Example Tutorial
How to access configuration values from application.properties file in Spring Boot? Example Tutorial
Spring Boot Tutorial for Beginners 7 - Spring Data JPA
Spring Boot Tutorial for Beginners 7 - Spring Data JPA
Spring Boot: Mastering Task Scheduling with Cron Expressions | Spring Boot Guide
Spring Boot: Mastering Task Scheduling with Cron Expressions | Spring Boot Guide
a blue background with the words spring boot configuring apache derby on it
a blue background with the words spring boot configuring apache derby on it

spring.profiles.active=dev

Now, all properties prefixed with dev., like dev.app.name, will be used in the development environment.

Using Custom Profiles

You can also create custom profiles:

application-dev.properties

dev.app.name=MyAppDev

Specify this profile in your application.properties file:

spring.profiles.include=dev

The dev.app.name property will now use the custom profile.

Property Placeholders

Spring Boot supports property placeholders using the syntax ${property}. This allows you to reference other properties:

my.app.version=${project.version}

Here, my.app.version will use the project.version value defined in your build tool (like Maven or Gradle).

Keep exploring, experimenting, and refining your use of the application.properties file. It's a powerful tool for configuring your Spring Boot applications!