If your configuration feels like a conspiracy theory you are not alone. Spring Boot reads and merges properties from several places to decide how your app behaves at runtime. Getting the order right stops mysterious overrides, saves hair and prevents late night pings from Ops.
Here is the practical priority you need to know, roughly from highest to lowest. Think of this as the referee who decides which setting wins.
YAML is supported and great for nested configuration and readability. Spring Boot merges configuration in most cases rather than replacing whole objects. That means you can override a single property without reworking the entire section, which is handy for sharing defaults across environments and tweaking a few values per profile.
Activate a profile with spring.profiles.active=dev or set the environment variable SPRING_PROFILES_ACTIVE when running in containers or CI. Profile specific files with the right suffix will override the main configuration for that profile. Yes this is obvious when it works and infuriating when it does not.
When compiling to a native binary with GraalVM resource scanning can behave differently. Property files may not be picked up unless they are explicitly included in the native image resource list. Test profile activation and your configuration as part of the native build pipeline so you do not discover problems at midnight in production.
Use spring.config.location and spring.config.additional-location to point Spring Boot at config files outside the jar. This is the right move when teams require externalized configuration, or when secrets must never be baked into artifacts.
In short, know the precedence, prefer environment variables or command line for CI, include property files in native image resources when using GraalVM and use Actuator to peek at the merged settings. Do that and your configuration will stop plotting against you.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.