Spring Profiles allow configuring environment-specific properties and beans in Spring Boot applications. Profile-specific property files follow the naming convention application-{profile}.properties, and beans can be conditionally registered using the @Profile annotation. Profile expressions support logical operators (&, |, !) for complex conditions. Profiles can be activated via the SPRING_PROFILES_ACTIVE environment variable, the spring.profiles.active system property, or the @ActiveProfiles annotation in tests. If no profile is activated, the default profile is used. Overusing profiles is discouraged as it can make configuration hard to understand.
Table of contents
Introducing Spring ProfilesProfile specific configuration using propertiesProfile specific configuration using Configuration classesUsing Profile ExpressionsHow to activate Spring ProfilesSummarySort: