From c2996bebcdff5db40f89e396bc34b7c2829ee9ec Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Sun, 5 Dec 2010 20:14:26 +0000 Subject: [PATCH] Use dot notation rather than camel case for profile props (SPR-7508) Before this change, the following properties could be used to manipulate Spring profile behavior: -DspringProfiles=p1,p2 -DdefaultSpringProfile=pD These properties have been renamed to follow usual Java conventions for property naming: -Dspring.profile.active=p1,p2 -Dspring.profile.default=pD git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3806 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../beans/factory/xml/spring-beans-3.1.xsd | 4 +++- .../springframework/context/annotation/Profile.java | 4 ++-- .../springframework/core/env/AbstractEnvironment.java | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/org.springframework.beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans-3.1.xsd b/org.springframework.beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans-3.1.xsd index 814a63c7036..68ffbf9ce9c 100644 --- a/org.springframework.beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans-3.1.xsd +++ b/org.springframework.beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans-3.1.xsd @@ -87,7 +87,9 @@ * profile="default" means that beans will be registered unless other profile(s) are active * profile="xyz,default" means that beans will be registered if 'xyz' is active or if no profile is active * ConfigurableEnvironment.setDefaultProfileName(String) customizes the name of the default profile - * 'defaultSpringProfile' property customizes the name of the default profile (usually for use as a + * 'spring.profile.default' property customizes the name of the default profile (usually for use as a + * ConfigurableEnvironment.setActiveProfiles(String...) sets which profiles are active + * 'spring.profile.active' sets which profiles are active (typically as a -D system property) servlet context/init param) ]]> diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Profile.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Profile.java index b3192d3d2fe..744463556da 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Profile.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Profile.java @@ -30,9 +30,9 @@ import java.lang.annotation.Target; * @Profile("default") means that beans will be registered unless other profile(s) are active * @Profile({"xyz,default"}) means that beans will be registered if 'xyz' is active or if no profile is active * ConfigurableEnvironment.setDefaultProfileName(String) customizes the name of the default profile - * 'defaultSpringProfile' property customizes the name of the default profile (usually for use as a servlet context/init param) + * 'spring.profile.default' property customizes the name of the default profile (usually for use as a servlet context/init param) * ConfigurableEnvironment.setActiveProfiles(String...) sets which profiles are active - * 'springProfiles' sets which profiles are active (typically as a -D system property) + * 'spring.profile.active' sets which profiles are active (typically as a -D system property) * * @author Chris Beams * @since 3.1 diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java b/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java index dd463a34c3f..dbabdf77b99 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java @@ -50,9 +50,9 @@ import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; */ public abstract class AbstractEnvironment implements ConfigurableEnvironment { - public static final String ACTIVE_PROFILES_PROPERTY_NAME = "springProfiles"; + public static final String ACTIVE_PROFILES_PROPERTY_NAME = "spring.profile.active"; - public static final String DEFAULT_PROFILE_PROPERTY_NAME = "defaultSpringProfile"; + public static final String DEFAULT_PROFILE_PROPERTY_NAME = "spring.profile.default"; /** * Default name of the default profile. Override with @@ -293,9 +293,9 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment { } public String getDefaultProfile() { - String defaultSpringProfileProperty = getProperty(DEFAULT_PROFILE_PROPERTY_NAME); - if (defaultSpringProfileProperty != null) { - return defaultSpringProfileProperty; + String defaultProfileProperty = getProperty(DEFAULT_PROFILE_PROPERTY_NAME); + if (defaultProfileProperty != null) { + return defaultProfileProperty; } return defaultProfile; }