Application Properties

application.properties is Spring Boot’s main external configuration file, located in src/main/resources. It holds settings such as the application name, server port, context path, database details, and your own custom values. It is used so behavior can change without touching Java code or recompiling. Values are read in code with @Value for a single property or @ConfigurationProperties for a whole group.

Types of properties

  1. Core/built-in: spring.application.name, server.port, server.servlet.context-path
  2. Datasource/JPA: spring.datasource.*, spring.jpa.*
  3. Custom: your own keys, e.g. student.college-name
  4. Other formats and sources: application.yml, profile files (application-dev.properties), environment variables, and command-line args (--server.port=9090), which override the file.

In a typical Spring Boot project—such as the capstone project guide at

https://javaplanet.io/frameworks/spring-boot/building-and-running-the-applicationcapstone-project/

the application.properties file located in src/main/resources serves as the central control panel for your entire application. It separates runtime configurations from your Java code so you can update settings without recompiling the project.

Key categories of properties configured in the file include:
  • Core/Built-in Settings: Control the fundamental runtime parameters of the embedded server, such as spring.application.name, server.port=8080, and server.servlet.context-path=/api/v1.
  • Datasource & Persistence: Manage database connections and JPA/Hibernate behavior using properties like spring.datasource.url, spring.datasource.username, and spring.jpa.hibernate.ddl-auto.
  • Custom Application Keys: Store domain-specific configurations (e.g., student.college-name=Global Tech Institute), which are injected directly into Java components using @Value for individual items or @ConfigurationProperties for grouped values.
  • Alternative Formats & Dynamic Overrides: Organize settings hierarchically via application.yml, split them by environment using profile files like application-dev.properties, or override them during deployment using environment variables and command-line flags (such as --server.port=9090).
Scroll to Top