How to use the Spring Boot application.properties file
Developers like to code. They declare variables, write methods and integrate classes together.
What developers aren't big on is configuration.
Simplified application configuration
It's a hassle to configure an application so that it can easily switch between test, pre-prod and production environments. It's the same to code a database application that can switch between a Postgres database in dev and a SQL Server database in production.
However, an application that is poorly configured will become a nightmare to manage and maintain. That is where Spring Boot's application.properties file comes in.
How Spring application.properties work
In this Spring Boot application.properties tutorial, you'll learn how to accomplish tasks including the following:
- Change the runtime server port Tomcat uses.
- Configure the Spring Boot startup banner.
- Reference values in the properties file in text files and Java code.
- Configure logging levels and patterns.
- Set the active Spring Boot profile for the runtime.
- Combine Spring properties and YAML files.
- Override Spring properties with JVM and Docker container arguments.
- Simplify access to Spring properties by setting prefixes.

Benefits of Spring Boot properties files
While configuring properties files might not be as exciting as extending a Java class or coding a Java component, doing so is equally important. Fortunately, Spring Boot greatly simplifies the process, allowing developers to spend more time on the business logic they love, and less time fighting with YAML syntax and name-value pairs in a property file.
Cameron McKenzie has been a Java EE software engineer for 20 years. His current specialties include Agile development; DevOps; Spring; and container-based technologies such as Docker, Swarm and Kubernetes.