Where is the application.properties file in a Spring Boot project?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
In a Spring Boot project, application.properties is the conventional file for application configuration. The short answer is that it normally lives in src/main/resources, but understanding why that location works, how external config overrides it, and how profiles fit in makes the answer much more useful.
Default Location Inside the Project
The standard location is:
That folder is placed on the runtime classpath when the application is built, so Spring Boot can discover the file automatically.
A typical project layout looks like this:
If you put the file there, Spring Boot will usually load it with no extra configuration.
What Goes in the File
The file contains key-value settings for the application.
These properties influence how Spring Boot configures the embedded server, data sources, logging, and many other features. Because the file is plain text, it is easy to version, review, and override.
Profile-Specific Files
Spring Boot also supports profile-specific variants such as application-dev.properties or application-prod.properties.
When a profile is active, Spring Boot combines the base file with the profile-specific file. For example, you might keep shared defaults in application.properties and only override environment-specific values in application-prod.properties.
Activate a profile with a property or command-line flag:
This is the normal way to keep one codebase but vary configuration across environments.
External Configuration Can Override It
The file does not have to live only inside the project. In deployment, teams often keep sensitive or environment-specific configuration outside the packaged application.
This is useful when the same build artifact is deployed to multiple environments and each environment needs different values.
You can also use directories such as ./config next to the JAR. Spring Boot knows several conventional search locations, and external files can override values found on the classpath.
Why Developers Sometimes Cannot Find It
A common source of confusion is that some projects use application.yml instead of application.properties. Both are valid. Another source is that configuration may be split across profiles, external files, environment variables, or command-line arguments.
So if you do not see application.properties in src/main/resources, that does not automatically mean the project is misconfigured. It may simply be using a different supported configuration source.
The practical question is not only "where is the file" but also "which configuration source is winning at runtime." That matters when a value in the file seems to be ignored.
In day-to-day development, this usually means checking the active profile, startup flags, environment variables, and any mounted config directories before assuming the file was not loaded. Spring Boot configuration is flexible, which is powerful, but that flexibility also means the winning value may come from somewhere other than the classpath file.
Common Pitfalls
- Looking in
src/main/javainstead ofsrc/main/resources. - Forgetting that
application.ymlmay be used instead ofapplication.properties. - Editing the base file while a profile-specific or external file is actually overriding the value.
- Storing secrets in version-controlled properties files when they should come from a safer source.
- Assuming the file must exist even in projects that rely on environment variables or other config sources.
Summary
- The default location is
src/main/resources/application.properties. - Spring Boot loads that file automatically because
resourcesis on the classpath. - Profile-specific files such as
application-dev.propertiesextend or override the base config. - External configuration can override classpath files in deployed environments.
- If a setting seems wrong, check all active configuration sources, not just the base file.
Related reading
- Where is the Java SDK folder in my computer? Ubuntu 12.04
- Where is the Keytool application?
- Where to add .ebextensions in a WAR?
- Where to get UTF-8 string literal in Java?
- Where to put Bean in Spring Boot?
- Where to put static files such as CSS in a spring-boot project?
- Where to set parameters min.insync.replicas and acks in Java?
- Which annotation should I use IdClass or EmbeddedId

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.