← All notes

Spring Boot profiles and externalized configuration

Answer: Spring Profiles provide a way to segregate parts of your application configuration and make it be available only in certain environments. (S1) Activate them with spring.profiles.active, for example --spring.profiles.active=dev. Profile-specific files like application-dev.yml override application.yml, and Spring Boot's ordered property sources let environment variables or command-line arguments override both.

# application.yml
server:
  port: 8080
---
spring:
  config:
    activate:
      on-profile: dev
server:
  port: 9090
@Configuration
@Profile("production")
public class ProductionConfiguration { }
java -jar app.jar --spring.profiles.active=dev,hsqldb
SPRING_PROFILES_ACTIVE=prod java -jar app.jar

Rules

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Spring (VMware/Broadcom), Profiles :: Spring Boot, Apache-2.0 (spring-projects repos); Spring (VMware/Broadcom), Externalized Configuration :: Spring Boot, Apache-2.0 (spring-projects repos).

Cite this

Permanent ID: iil:note:5dy22b3w

iinventedlight. 2026. "Spring Boot profiles and externalized configuration." iinventedlight Library, iil:note:5dy22b3w, version of 2026-11-04. https://iinventedlight.com/library/notes/spring-boot-profiles/. License: CC-BY-4.0.

@misc{iil_note_5dy22b3w,
  author = {{iinventedlight}},
  title = {{Spring Boot profiles and externalized configuration}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/spring-boot-profiles/},
  note = {Permanent ID iil:note:5dy22b3w. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/spring-boot-profiles.md.