Spring Boot loads properties file over yml file

Spent 10 minutes wondering why my Spring Boot app wasn't picking up my application.yml values. The config looked fine: server: port: 8081 But the app kept starting on 8080. The problem: My application.yml was in src/main/resources but I also had an application-properties file in the same folder. Spring Boot loads both. Properties file wins. The fix: Delete the duplicate or merge them. Don't mix both unless you know the load order. Spring Boot priority: properties file > yml file Small overlap. Silent failure. Easy to miss. #SpringBoot #Java #BackendDevelopment #Programming

Same thing happens with profile-specific configs. If you have application-dev.yml and application-dev . properties, properties wins again. Keep configs in one format to avoid surprises.

Like
Reply

To view or add a comment, sign in

Explore content categories