← Spring Boot learning pathSpring Boot · Module 6 of 10
Configuration and profiles
Configure apps for dev, test and production.
📖 Key ideas
- application.yml holds settings like server.port and datasource URL.
- Profiles: application-dev.yml, application-prod.yml.
- Activate with spring.profiles.active=prod.
- Environment variables override properties (SPRING_DATASOURCE_URL).
- @ConfigurationProperties binds settings to a typed class.
💡 Real-life example: Profiles are outfits for occasions: same person (app), different clothes (settings) for office or gym.
ProfileNamed set of configuration
application.ymlMain configuration file
@ConfigurationPropertiesBinds settings to a class
Externalised configSettings outside the code