From c06752ef721694e59318d59af0cb7dee76b5dedb Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Fri, 20 May 2011 03:53:37 +0000 Subject: [PATCH] Rename {Default=>Standard}Environment Issue: SPR-8348 --- .../support/AbstractBeanDefinitionReader.java | 8 +-- .../factory/support/AbstractBeanFactory.java | 2 +- .../xml/BeanDefinitionParserDelegate.java | 6 +-- .../support/ResourceEditorRegistrar.java | 6 +-- .../factory/xml/NestedBeansElementTests.java | 4 +- .../xml/ProfileXmlBeanDefinitionTests.java | 14 +++--- .../AnnotatedBeanDefinitionReader.java | 6 +-- .../ClassPathBeanDefinitionScanner.java | 5 +- ...athScanningCandidateComponentProvider.java | 6 +-- .../support/AbstractApplicationContext.java | 6 +-- .../AsmCircularImportDetectionTests.java | 4 +- ...anningCandidateComponentProviderTests.java | 6 +-- ...ertySourcesPlaceholderConfigurerTests.java | 4 +- .../core/env/AbstractEnvironment.java | 2 +- .../core/env/ConfigurableEnvironment.java | 4 +- .../springframework/core/env/Environment.java | 4 +- ...ironment.java => StandardEnvironment.java} | 8 +-- .../core/io/ResourceEditor.java | 12 ++--- .../support/ResourceArrayPropertyEditor.java | 14 +++--- .../core/env/EnvironmentTests.java | 12 ++--- .../core/io/ResourceEditorTests.java | 4 +- .../core/env/EnvironmentIntegrationTests.java | 50 +++++++++---------- .../context/SpringContextResourceAdapter.java | 6 +-- .../context/DefaultPortletEnvironment.java | 10 ++-- .../support/DefaultWebEnvironment.java | 10 ++-- .../support/DefaultWebEnvironmentTests.java | 14 +++--- 26 files changed, 114 insertions(+), 113 deletions(-) rename org.springframework.core/src/main/java/org/springframework/core/env/{DefaultEnvironment.java => StandardEnvironment.java} (93%) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java index 333757b75f9..d0f524ed7d1 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java @@ -22,7 +22,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanDefinitionStoreException; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.EnvironmentCapable; import org.springframework.core.io.Resource; @@ -54,7 +54,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable private ClassLoader beanClassLoader; - private Environment environment = new DefaultEnvironment(); + private Environment environment = new StandardEnvironment(); private BeanNameGenerator beanNameGenerator = new DefaultBeanNameGenerator(); @@ -69,7 +69,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable * {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}. *

If the the passed-in bean factory also implements {@link EnvironmentCapable} its * environment will be used by this reader. Otherwise, the reader will initialize and - * use a {@link DefaultEnvironment}. All ApplicationContext implementations are + * use a {@link StandardEnvironment}. All ApplicationContext implementations are * EnvironmentCapable, while normal BeanFactory implementations are not. * @param registry the BeanFactory to load bean definitions into, * in the form of a BeanDefinitionRegistry @@ -93,7 +93,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable this.environment = ((EnvironmentCapable)this.registry).getEnvironment(); } else { - this.environment = new DefaultEnvironment(); + this.environment = new StandardEnvironment(); } } diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java index 6b540075340..889aac20504 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java @@ -69,7 +69,7 @@ import org.springframework.core.DecoratingClassLoader; import org.springframework.core.NamedThreadLocal; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java index 3cc7e29abcc..17ba6b8487f 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java @@ -59,7 +59,7 @@ import org.springframework.beans.factory.support.ManagedProperties; import org.springframework.beans.factory.support.ManagedSet; import org.springframework.beans.factory.support.MethodOverrides; import org.springframework.beans.factory.support.ReplaceOverride; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -272,13 +272,13 @@ public class BeanDefinitionParserDelegate { /** * Create a new BeanDefinitionParserDelegate associated with the - * supplied {@link XmlReaderContext} and a new {@link DefaultEnvironment}. + * supplied {@link XmlReaderContext} and a new {@link StandardEnvironment}. * @deprecated since Spring 3.1 in favor of * {@link #BeanDefinitionParserDelegate(XmlReaderContext, Environment)} */ @Deprecated public BeanDefinitionParserDelegate(XmlReaderContext readerContext) { - this(readerContext, new DefaultEnvironment()); + this(readerContext, new StandardEnvironment()); } /** diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java b/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java index 696917ea7a6..d1ca79798ca 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java @@ -34,7 +34,7 @@ import org.springframework.beans.propertyeditors.InputSourceEditor; import org.springframework.beans.propertyeditors.InputStreamEditor; import org.springframework.beans.propertyeditors.URIEditor; import org.springframework.beans.propertyeditors.URLEditor; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.PropertyResolver; import org.springframework.core.io.Resource; @@ -64,7 +64,7 @@ public class ResourceEditorRegistrar implements PropertyEditorRegistrar { /** * Create a new ResourceEditorRegistrar for the given {@link ResourceLoader} - * using a {@link DefaultEnvironment}. + * using a {@link StandardEnvironment}. * @param resourceLoader the ResourceLoader (or ResourcePatternResolver) * to create editors for (usually an ApplicationContext) * @see org.springframework.core.io.support.ResourcePatternResolver @@ -74,7 +74,7 @@ public class ResourceEditorRegistrar implements PropertyEditorRegistrar { */ @Deprecated public ResourceEditorRegistrar(ResourceLoader resourceLoader) { - this(resourceLoader, new DefaultEnvironment()); + this(resourceLoader, new StandardEnvironment()); } /** diff --git a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementTests.java index 288025eca2b..cb780fb3e1e 100644 --- a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementTests.java +++ b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementTests.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertThat; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -30,7 +30,7 @@ public class NestedBeansElementTests { @Test public void getBean_withActiveProfile() { - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); env.setActiveProfiles("dev"); DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); diff --git a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java index e750be96dd8..1f9bc2a36aa 100644 --- a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java +++ b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java @@ -26,7 +26,7 @@ import org.junit.internal.matchers.TypeSafeMatcher; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.ClassPathResource; /** @@ -99,7 +99,7 @@ public class ProfileXmlBeanDefinitionTests { { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); env.setDefaultProfiles("custom-default"); reader.setEnvironment(env); reader.loadBeanDefinitions(new ClassPathResource(DEFAULT_ELIGIBLE_XML, getClass())); @@ -109,7 +109,7 @@ public class ProfileXmlBeanDefinitionTests { { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); env.setDefaultProfiles("custom-default"); reader.setEnvironment(env); reader.loadBeanDefinitions(new ClassPathResource(CUSTOM_DEFAULT_ELIGIBLE_XML, getClass())); @@ -126,7 +126,7 @@ public class ProfileXmlBeanDefinitionTests { { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); env.setActiveProfiles(DEV_ACTIVE); env.setDefaultProfiles("default"); reader.setEnvironment(env); @@ -136,7 +136,7 @@ public class ProfileXmlBeanDefinitionTests { { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); // env.setActiveProfiles(DEV_ACTIVE); env.setDefaultProfiles("default"); reader.setEnvironment(env); @@ -146,7 +146,7 @@ public class ProfileXmlBeanDefinitionTests { { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); // env.setActiveProfiles(DEV_ACTIVE); //env.setDefaultProfiles("default"); reader.setEnvironment(env); @@ -159,7 +159,7 @@ public class ProfileXmlBeanDefinitionTests { private BeanDefinitionRegistry beanFactoryFor(String xmlName, String... activeProfiles) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); - DefaultEnvironment env = new DefaultEnvironment(); + StandardEnvironment env = new StandardEnvironment(); env.setActiveProfiles(activeProfiles); reader.setEnvironment(env); reader.loadBeanDefinitions(new ClassPathResource(xmlName, getClass())); diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java index 504dffb07d3..720891d9a61 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier; import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanNameGenerator; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotationMetadata; @@ -42,7 +42,7 @@ public class AnnotatedBeanDefinitionReader { private final BeanDefinitionRegistry registry; - private Environment environment = new DefaultEnvironment(); + private Environment environment = new StandardEnvironment(); private BeanNameGenerator beanNameGenerator = new AnnotationBeanNameGenerator(); @@ -70,7 +70,7 @@ public class AnnotatedBeanDefinitionReader { /** * Set the Environment to use when evaluating whether * {@link Profile @Profile}-annotated component classes should be registered. - *

The default is a {@link DefaultEnvironment}. + *

The default is a {@link StandardEnvironment}. * @see #registerBean(Class, String, Class...) */ public void setEnvironment(Environment environment) { diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java index 89540c33255..c931d6ee1a3 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java @@ -91,8 +91,9 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo * {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}. *

If the the passed-in bean factory also implements {@link EnvironmentCapable} its * environment will be used by this reader. Otherwise, the reader will initialize and - * use a {@link DefaultEnvironment}. All ApplicationContext implementations are - * EnvironmentCapable, while normal BeanFactory implementations are not. + * use a {@link org.springframework.core.env.StandardEnvironment}. All + * ApplicationContext implementations are EnvironmentCapable, while normal BeanFactory + * implementations are not. * @param registry the BeanFactory to load bean definitions into, * in the form of a BeanDefinitionRegistry * @param useDefaultFilters whether to include the default filters for the diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java index 9c57ad45228..d077ac89b2b 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java @@ -29,7 +29,7 @@ import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.ResourceLoaderAware; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.EnvironmentCapable; import org.springframework.core.io.Resource; @@ -73,7 +73,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC protected final Log logger = LogFactory.getLog(getClass()); - private Environment environment = new DefaultEnvironment(); + private Environment environment = new StandardEnvironment(); private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); @@ -117,7 +117,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC /** * Set the Environment to use when resolving placeholders and evaluating * {@link Profile @Profile}-annotated component classes. - *

The default is a {@link DefaultEnvironment} + *

The default is a {@link StandardEnvironment} * @param environment the Environment to use */ public void setEnvironment(Environment environment) { diff --git a/org.springframework.context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/org.springframework.context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index 6c95304f682..ecc13c9a52f 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/org.springframework.context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java @@ -73,7 +73,7 @@ import org.springframework.core.Ordered; import org.springframework.core.PriorityOrdered; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; @@ -410,12 +410,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader } /** - * Create and return a new {@link DefaultEnvironment}. + * Create and return a new {@link StandardEnvironment}. *

Subclasses may override this method in order to supply * a custom {@link ConfigurableEnvironment} implementation. */ protected ConfigurableEnvironment createEnvironment() { - return new DefaultEnvironment(); + return new StandardEnvironment(); } public void refresh() throws BeansException, IllegalStateException { diff --git a/org.springframework.context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java b/org.springframework.context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java index 8cba62fa698..17b232da595 100644 --- a/org.springframework.context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java +++ b/org.springframework.context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java @@ -17,7 +17,7 @@ package org.springframework.context.annotation; import org.springframework.beans.factory.parsing.FailFastProblemReporter; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.type.classreading.CachingMetadataReaderFactory; @@ -38,7 +38,7 @@ public class AsmCircularImportDetectionTests extends AbstractCircularImportDetec return new ConfigurationClassParser( new CachingMetadataReaderFactory(), new FailFastProblemReporter(), - new DefaultEnvironment(), + new StandardEnvironment(), new DefaultResourceLoader(), new DefaultListableBeanFactory()); } diff --git a/org.springframework.context/src/test/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProviderTests.java b/org.springframework.context/src/test/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProviderTests.java index 0a45a5d02e0..a1f863fc07e 100644 --- a/org.springframework.context/src/test/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProviderTests.java +++ b/org.springframework.context/src/test/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProviderTests.java @@ -30,7 +30,7 @@ import org.aspectj.lang.annotation.Aspect; import org.junit.Test; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.type.filter.AnnotationTypeFilter; import org.springframework.core.type.filter.AssignableTypeFilter; import org.springframework.core.type.filter.RegexPatternTypeFilter; @@ -175,7 +175,7 @@ public class ClassPathScanningCandidateComponentProviderTests { @Test public void testWithInactiveProfile() { ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); env.setActiveProfiles("other"); provider.setEnvironment(env); Set candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE); @@ -185,7 +185,7 @@ public class ClassPathScanningCandidateComponentProviderTests { @Test public void testWithActiveProfile() { ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true); - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); env.setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME); provider.setEnvironment(env); Set candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE); diff --git a/org.springframework.context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java b/org.springframework.context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java index bc0bf3193fa..8226dae1864 100644 --- a/org.springframework.context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java +++ b/org.springframework.context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java @@ -28,7 +28,7 @@ import java.util.Properties; import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; @@ -233,7 +233,7 @@ public class PropertySourcesPlaceholderConfigurerTests { System.setProperty("key1", "systemKey1Value"); System.setProperty("key2", "systemKey2Value"); - ppc.setEnvironment(new DefaultEnvironment()); + ppc.setEnvironment(new StandardEnvironment()); ppc.postProcessBeanFactory(bf); System.clearProperty("key1"); System.clearProperty("key2"); 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 9bc6c3a8aeb..b7c820ac7f0 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 @@ -41,7 +41,7 @@ import org.springframework.util.StringUtils; * * @author Chris Beams * @since 3.1 - * @see DefaultEnvironment + * @see StandardEnvironment */ public abstract class AbstractEnvironment implements ConfigurableEnvironment { diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java b/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java index af934ba875b..7e41e73b2f0 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java @@ -25,7 +25,7 @@ import java.util.Map; * * @author Chris Beams * @since 3.1 - * @see DefaultEnvironment + * @see StandardEnvironment * @see org.springframework.context.ConfigurableApplicationContext#getEnvironment */ public interface ConfigurableEnvironment extends Environment, ConfigurablePropertyResolver { @@ -61,7 +61,7 @@ public interface ConfigurableEnvironment extends Environment, ConfigurableProper * certain user-defined property sources have search precedence over default property * sources such as the set of system properties or the set of system environment * variables. - * @see DefaultEnvironment#DefaultEnvironment() + * @see AbstractEnvironment#customizePropertySources */ MutablePropertySources getPropertySources(); diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/Environment.java b/org.springframework.core/src/main/java/org/springframework/core/env/Environment.java index e6aeaa35358..e412384458d 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/Environment.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/Environment.java @@ -52,7 +52,7 @@ package org.springframework.core.env; *

Configuration of the environment object must be done through the * {@link ConfigurableEnvironment} interface, returned from all * {@code AbstractApplicationContext} subclass {@code getEnvironment()} methods. See - * {@link DefaultEnvironment} for several examples of using the ConfigurableEnvironment + * {@link StandardEnvironment} for several examples of using the ConfigurableEnvironment * interface to manipulate property sources prior to application context refresh(). * * @author Chris Beams @@ -61,7 +61,7 @@ package org.springframework.core.env; * @see EnvironmentCapable * @see ConfigurableEnvironment * @see AbstractEnvironment - * @see DefaultEnvironment + * @see StandardEnvironment * @see org.springframework.context.EnvironmentAware * @see org.springframework.context.ConfigurableApplicationContext#getEnvironment * @see org.springframework.context.ConfigurableApplicationContext#setEnvironment diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/DefaultEnvironment.java b/org.springframework.core/src/main/java/org/springframework/core/env/StandardEnvironment.java similarity index 93% rename from org.springframework.core/src/main/java/org/springframework/core/env/DefaultEnvironment.java rename to org.springframework.core/src/main/java/org/springframework/core/env/StandardEnvironment.java index 0d8cf23cdf1..69ca266f57f 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/DefaultEnvironment.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/StandardEnvironment.java @@ -41,7 +41,7 @@ package org.springframework.core.env; * *

Example: adding a new property source with highest search priority

*
- *   ConfigurableEnvironment environment = new DefaultEnvironment();
+ *   ConfigurableEnvironment environment = new StandardEnvironment();
  *   MutablePropertySources propertySources = environment.getPropertySources();
  *   Map myMap = new HashMap();
  *   myMap.put("xyz", "myValue");
@@ -51,14 +51,14 @@ package org.springframework.core.env;
  * 

Example: removing the default system properties property source

*
  *   MutablePropertySources propertySources = environment.getPropertySources();
- *   propertySources.remove(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)
+ *   propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)
  * 
* *

Example: mocking the system environment for testing purposes

*
  *   MutablePropertySources propertySources = environment.getPropertySources();
  *   MockPropertySource mockEnvVars = new MockPropertySource().withProperty("xyz", "myValue");
- *   propertySources.replace(DefaultEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, mockEnvVars);
+ *   propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, mockEnvVars);
  * 
* * When an {@link Environment} is being used by an ApplicationContext, it is important @@ -73,7 +73,7 @@ package org.springframework.core.env; * @see ConfigurableEnvironment * @see org.springframework.web.context.support.DefaultWebEnvironment */ -public class DefaultEnvironment extends AbstractEnvironment { +public class StandardEnvironment extends AbstractEnvironment { /** System environment property source name: {@value} */ public static final String SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME = "systemEnvironment"; diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java b/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java index 204c2f8a2b7..0b812a42b8b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java @@ -19,7 +19,7 @@ package org.springframework.core.io; import java.beans.PropertyEditorSupport; import java.io.IOException; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.PropertyResolver; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -58,22 +58,22 @@ public class ResourceEditor extends PropertyEditorSupport { /** * Create a new instance of the {@link ResourceEditor} class - * using a {@link DefaultResourceLoader} and {@link DefaultEnvironment}. + * using a {@link DefaultResourceLoader} and {@link StandardEnvironment}. */ public ResourceEditor() { - this(new DefaultResourceLoader(), new DefaultEnvironment()); + this(new DefaultResourceLoader(), new StandardEnvironment()); } /** * Create a new instance of the {@link ResourceEditor} class - * using the given {@link ResourceLoader} and a {@link DefaultEnvironment}. + * using the given {@link ResourceLoader} and a {@link StandardEnvironment}. * @param resourceLoader the ResourceLoader to use * @deprecated as of Spring 3.1 in favor of * {@link #ResourceEditor(ResourceLoader, PropertyResolver)} */ @Deprecated public ResourceEditor(ResourceLoader resourceLoader) { - this(resourceLoader, new DefaultEnvironment(), true); + this(resourceLoader, new StandardEnvironment(), true); } /** @@ -97,7 +97,7 @@ public class ResourceEditor extends PropertyEditorSupport { */ @Deprecated public ResourceEditor(ResourceLoader resourceLoader, boolean ignoreUnresolvablePlaceholders) { - this(resourceLoader, new DefaultEnvironment(), ignoreUnresolvablePlaceholders); + this(resourceLoader, new StandardEnvironment(), ignoreUnresolvablePlaceholders); } /** diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java b/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java index 45bafe700ac..e09dd9f90b0 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java @@ -25,7 +25,7 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.PropertyResolver; import org.springframework.core.io.Resource; @@ -64,23 +64,23 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport { /** * Create a new ResourceArrayPropertyEditor with a default - * {@link PathMatchingResourcePatternResolver} and {@link DefaultEnvironment}. + * {@link PathMatchingResourcePatternResolver} and {@link StandardEnvironment}. * @see PathMatchingResourcePatternResolver * @see Environment */ public ResourceArrayPropertyEditor() { - this(new PathMatchingResourcePatternResolver(), new DefaultEnvironment(), true); + this(new PathMatchingResourcePatternResolver(), new StandardEnvironment(), true); } /** * Create a new ResourceArrayPropertyEditor with the given {@link ResourcePatternResolver} - * and a {@link DefaultEnvironment}. + * and a {@link StandardEnvironment}. * @param resourcePatternResolver the ResourcePatternResolver to use * @deprecated as of 3.1 in favor of {@link #ResourceArrayPropertyEditor(ResourcePatternResolver, Environment)} */ @Deprecated public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver) { - this(resourcePatternResolver, new DefaultEnvironment(), true); + this(resourcePatternResolver, new StandardEnvironment(), true); } /** @@ -95,7 +95,7 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport { /** * Create a new ResourceArrayPropertyEditor with the given {@link ResourcePatternResolver} - * and a {@link DefaultEnvironment}. + * and a {@link StandardEnvironment}. * @param resourcePatternResolver the ResourcePatternResolver to use * @param ignoreUnresolvablePlaceholders whether to ignore unresolvable placeholders * if no corresponding system property could be found @@ -103,7 +103,7 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport { */ @Deprecated public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, boolean ignoreUnresolvablePlaceholders) { - this(resourcePatternResolver, new DefaultEnvironment(), ignoreUnresolvablePlaceholders); + this(resourcePatternResolver, new StandardEnvironment(), ignoreUnresolvablePlaceholders); } /** diff --git a/org.springframework.core/src/test/java/org/springframework/core/env/EnvironmentTests.java b/org.springframework.core/src/test/java/org/springframework/core/env/EnvironmentTests.java index 34172606fac..e788ecca395 100644 --- a/org.springframework.core/src/test/java/org/springframework/core/env/EnvironmentTests.java +++ b/org.springframework.core/src/test/java/org/springframework/core/env/EnvironmentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ import org.junit.Test; import org.springframework.mock.env.MockPropertySource; /** - * Unit tests for {@link DefaultEnvironment}. + * Unit tests for {@link StandardEnvironment}. * * @author Chris Beams */ @@ -60,14 +60,14 @@ public class EnvironmentTests { private static final Object NON_STRING_PROPERTY_NAME = new Object(); private static final Object NON_STRING_PROPERTY_VALUE = new Object(); - private ConfigurableEnvironment environment = new DefaultEnvironment(); + private ConfigurableEnvironment environment = new StandardEnvironment(); @Test public void propertySourceOrder() { - ConfigurableEnvironment env = new DefaultEnvironment(); + ConfigurableEnvironment env = new StandardEnvironment(); MutablePropertySources sources = env.getPropertySources(); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(0)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(1)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(0)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(1)); assertThat(sources.size(), is(2)); } diff --git a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java index 6558875c1fd..ff6a1fc6e51 100644 --- a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java +++ b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java @@ -20,7 +20,7 @@ import java.beans.PropertyEditor; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; /** * Unit tests for the {@link ResourceEditor} class. @@ -75,7 +75,7 @@ public final class ResourceEditorTests { @Test(expected=IllegalArgumentException.class) public void testStrictSystemPropertyReplacement() { - PropertyEditor editor = new ResourceEditor(new DefaultResourceLoader(), new DefaultEnvironment(), false); + PropertyEditor editor = new ResourceEditor(new DefaultResourceLoader(), new StandardEnvironment(), false); System.setProperty("test.prop", "foo"); try { editor.setAsText("${test.prop}-${bar}"); diff --git a/org.springframework.integration-tests/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java b/org.springframework.integration-tests/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java index 30d0b2705a5..c39ca126bca 100644 --- a/org.springframework.integration-tests/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java +++ b/org.springframework.integration-tests/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java @@ -85,7 +85,7 @@ import org.springframework.web.portlet.context.XmlPortletApplicationContext; * * Tests all existing BeanFactory and ApplicationContext implementations to * ensure that: - * - a default environment object is always present + * - a standard environment object is always present * - a custom environment object can be set and retrieved against the factory/context * - the {@link EnvironmentAware} interface is respected * - the environment object is registered with the container as a singleton @@ -120,21 +120,21 @@ public class EnvironmentIntegrationTests { @Before public void setUp() { - prodEnv = new DefaultEnvironment(); + prodEnv = new StandardEnvironment(); prodEnv.setActiveProfiles(PROD_ENV_NAME); - devEnv = new DefaultEnvironment(); + devEnv = new StandardEnvironment(); devEnv.setActiveProfiles(DEV_ENV_NAME); } @Test - public void genericApplicationContext_defaultEnv() { + public void genericApplicationContext_standardEnv() { ConfigurableApplicationContext ctx = new GenericApplicationContext(newBeanFactoryWithEnvironmentAwareBean()); ctx.refresh(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); assertEnvironmentBeanRegistered(ctx); assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment()); } @@ -199,7 +199,7 @@ public class EnvironmentIntegrationTests { public void genericXmlApplicationContext() { GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); ctx.setEnvironment(prodEnv); @@ -249,7 +249,7 @@ public class EnvironmentIntegrationTests { public void annotationConfigApplicationContext_withPojos() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); ctx.setEnvironment(prodEnv); ctx.register(EnvironmentAwareBean.class); @@ -262,7 +262,7 @@ public class EnvironmentIntegrationTests { public void annotationConfigApplicationContext_withProdEnvAndProdConfigClass() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); ctx.setEnvironment(prodEnv); ctx.register(ProdConfig.class); @@ -275,7 +275,7 @@ public class EnvironmentIntegrationTests { public void annotationConfigApplicationContext_withProdEnvAndDevConfigClass() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); ctx.setEnvironment(prodEnv); ctx.register(DevConfig.class); @@ -289,7 +289,7 @@ public class EnvironmentIntegrationTests { public void annotationConfigApplicationContext_withDevEnvAndDevConfigClass() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); ctx.setEnvironment(devEnv); ctx.register(DevConfig.class); @@ -303,7 +303,7 @@ public class EnvironmentIntegrationTests { public void annotationConfigApplicationContext_withImportedConfigClasses() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); ctx.setEnvironment(prodEnv); ctx.register(Config.class); @@ -318,7 +318,7 @@ public class EnvironmentIntegrationTests { @Test public void mostSpecificDerivedClassDrivesEnvironment_withDerivedDevEnvAndDerivedDevConfigClass() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - DefaultEnvironment derivedDevEnv = new DefaultEnvironment(); + StandardEnvironment derivedDevEnv = new StandardEnvironment(); derivedDevEnv.setActiveProfiles(DERIVED_DEV_ENV_NAME); ctx.setEnvironment(derivedDevEnv); ctx.register(DerivedDevConfig.class); @@ -374,7 +374,7 @@ public class EnvironmentIntegrationTests { public void staticApplicationContext() { StaticApplicationContext ctx = new StaticApplicationContext(); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); registerEnvironmentBeanDefinition(ctx); @@ -446,13 +446,13 @@ public class EnvironmentIntegrationTests { // Servlet* PropertySources have precedence over System* PropertySources assertThat(propertySources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)), - lessThan(propertySources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)))); + lessThan(propertySources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)))); // Replace system properties with a mock property source for convenience - MockPropertySource mockSystemProperties = new MockPropertySource(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); + MockPropertySource mockSystemProperties = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); mockSystemProperties.setProperty("pCommon", "pCommonSysPropsValue"); mockSystemProperties.setProperty("pSysProps1", "pSysProps1Value"); - propertySources.replace(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties); + propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties); // assert that servletconfig params resolve with higher precedence than sysprops assertThat(environment.getProperty("pCommon"), is("pCommonConfigValue")); @@ -480,13 +480,13 @@ public class EnvironmentIntegrationTests { // Servlet* PropertySources have precedence over System* PropertySources assertThat(propertySources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)), - lessThan(propertySources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)))); + lessThan(propertySources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)))); // Replace system properties with a mock property source for convenience - MockPropertySource mockSystemProperties = new MockPropertySource(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); + MockPropertySource mockSystemProperties = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); mockSystemProperties.setProperty("pCommon", "pCommonSysPropsValue"); mockSystemProperties.setProperty("pSysProps1", "pSysProps1Value"); - propertySources.replace(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties); + propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties); // assert that servletcontext init params resolve with higher precedence than sysprops assertThat(environment.getProperty("pCommon"), is("pCommonContextValue")); @@ -523,13 +523,13 @@ public class EnvironmentIntegrationTests { // Servlet* PropertySources have precedence over System* PropertySources assertThat(propertySources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)), - lessThan(propertySources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)))); + lessThan(propertySources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)))); // Replace system properties with a mock property source for convenience - MockPropertySource mockSystemProperties = new MockPropertySource(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); + MockPropertySource mockSystemProperties = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); mockSystemProperties.setProperty("pCommon", "pCommonSysPropsValue"); mockSystemProperties.setProperty("pSysProps1", "pSysProps1Value"); - propertySources.replace(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties); + propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties); // assert that servletconfig params resolve with higher precedence than sysprops assertThat(environment.getProperty("pCommon"), is("pCommonConfigValue")); @@ -540,7 +540,7 @@ public class EnvironmentIntegrationTests { public void resourceAdapterApplicationContext() { ResourceAdapterApplicationContext ctx = new ResourceAdapterApplicationContext(new SimpleBootstrapContext(new SimpleTaskWorkManager())); - assertHasDefaultEnvironment(ctx); + assertHasStandardEnvironment(ctx); registerEnvironmentBeanDefinition(ctx); @@ -626,10 +626,10 @@ public class EnvironmentIntegrationTests { assertThat(ctx.containsBean(ENVIRONMENT_BEAN_NAME), is(true)); } - private void assertHasDefaultEnvironment(ApplicationContext ctx) { + private void assertHasStandardEnvironment(ApplicationContext ctx) { Environment defaultEnv = ctx.getEnvironment(); assertThat(defaultEnv, notNullValue()); - assertThat(defaultEnv, instanceOf(DefaultEnvironment.class)); + assertThat(defaultEnv, instanceOf(StandardEnvironment.class)); } private void assertHasDefaultWebEnvironment(WebApplicationContext ctx) { diff --git a/org.springframework.transaction/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java b/org.springframework.transaction/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java index 48b46fe59f3..418bcc4cec0 100644 --- a/org.springframework.transaction/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java +++ b/org.springframework.transaction/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java @@ -32,7 +32,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.util.StringUtils; /** @@ -144,12 +144,12 @@ public class SpringContextResourceAdapter implements ResourceAdapter { } /** - * Return a new {@link DefaultEnvironment}. + * Return a new {@link StandardEnvironment}. *

Subclasses may override this method in order to supply * a custom {@link ConfigurableEnvironment} implementation. */ protected ConfigurableEnvironment createEnvironment() { - return new DefaultEnvironment(); + return new StandardEnvironment(); } /** diff --git a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/DefaultPortletEnvironment.java b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/DefaultPortletEnvironment.java index 2c3a71e17a3..5c6fff3cbfd 100644 --- a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/DefaultPortletEnvironment.java +++ b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/DefaultPortletEnvironment.java @@ -20,7 +20,7 @@ import javax.portlet.PortletConfig; import javax.portlet.PortletContext; import javax.servlet.ServletContext; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; @@ -38,10 +38,10 @@ import org.springframework.web.context.support.DefaultWebEnvironment; * * @author Chris Beams * @since 3.1 - * @see DefaultEnvironment + * @see StandardEnvironment * @see DefaultWebEnvironment */ -public class DefaultPortletEnvironment extends DefaultEnvironment { +public class DefaultPortletEnvironment extends StandardEnvironment { /** Portlet context init parameters property source name: {@value} */ public static final String PORTLET_CONTEXT_PROPERTY_SOURCE_NAME = "portletContextInitParams"; @@ -62,12 +62,12 @@ public class DefaultPortletEnvironment extends DefaultEnvironment { * which takes precedence over those in * {@linkplain DefaultWebEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}. *

Properties in any of the above will take precedence over system properties and environment - * variables contributed by the {@link DefaultEnvironment} superclass. + * variables contributed by the {@link StandardEnvironment} superclass. *

The property sources are added as stubs for now, and will be * {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully initialized} * once the actual {@link PortletConfig}, {@link PortletContext}, and {@link ServletContext} * objects are available. - * @see DefaultEnvironment#customizePropertySources + * @see StandardEnvironment#customizePropertySources * @see PortletConfigPropertySource * @see PortletContextPropertySource * @see AbstractRefreshablePortletApplicationContext#initPropertySources diff --git a/org.springframework.web/src/main/java/org/springframework/web/context/support/DefaultWebEnvironment.java b/org.springframework.web/src/main/java/org/springframework/web/context/support/DefaultWebEnvironment.java index 9fd2b6aa67c..c8a16d3f5d0 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/context/support/DefaultWebEnvironment.java +++ b/org.springframework.web/src/main/java/org/springframework/web/context/support/DefaultWebEnvironment.java @@ -19,7 +19,7 @@ package org.springframework.web.context.support; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; @@ -42,10 +42,10 @@ import org.springframework.jndi.JndiPropertySource; * * @author Chris Beams * @since 3.1 - * @see DefaultEnvironment + * @see StandardEnvironment * @see DefaultPortletEnvironment */ -public class DefaultWebEnvironment extends DefaultEnvironment { +public class DefaultWebEnvironment extends StandardEnvironment { /** Servlet context init parameters property source name: {@value} */ public static final String SERVLET_CONTEXT_PROPERTY_SOURCE_NAME = "servletContextInitParams"; @@ -64,7 +64,7 @@ public class DefaultWebEnvironment extends DefaultEnvironment { *

Properties present in {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME} will * take precedence over those in {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}. *

Properties in any of the above will take precedence over system properties and environment - * variables contributed by the {@link DefaultEnvironment} superclass. + * variables contributed by the {@link StandardEnvironment} superclass. *

The {@code Servlet}-related property sources are added as stubs for now, and will be * {@linkplain WebApplicationContextUtils#initServletPropertySources fully initialized} * once the actual {@link ServletConfig} and {@link ServletContext} objects are available. @@ -72,7 +72,7 @@ public class DefaultWebEnvironment extends DefaultEnvironment { * property is present in any of the default property sources, a {@link JndiPropertySource} will * be added as well, with precedence lower than servlet property sources, but higher than system * properties and environment variables. - * @see DefaultEnvironment#customizePropertySources + * @see StandardEnvironment#customizePropertySources * @see ServletConfigPropertySource * @see ServletContextPropertySource * @see org.springframework.jndi.JndiPropertySource diff --git a/org.springframework.web/src/test/java/org/springframework/web/context/support/DefaultWebEnvironmentTests.java b/org.springframework.web/src/test/java/org/springframework/web/context/support/DefaultWebEnvironmentTests.java index e7e1950a30f..ebe97fe9d1b 100644 --- a/org.springframework.web/src/test/java/org/springframework/web/context/support/DefaultWebEnvironmentTests.java +++ b/org.springframework.web/src/test/java/org/springframework/web/context/support/DefaultWebEnvironmentTests.java @@ -22,7 +22,7 @@ import static org.junit.Assert.assertThat; import org.junit.Test; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DefaultEnvironment; +import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource; import org.springframework.jndi.JndiPropertySource; @@ -35,8 +35,8 @@ public class DefaultWebEnvironmentTests { MutablePropertySources sources = env.getPropertySources(); assertThat(sources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)), equalTo(0)); assertThat(sources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)), equalTo(1)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(2)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(3)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(2)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(3)); assertThat(sources.size(), is(4)); } @@ -49,8 +49,8 @@ public class DefaultWebEnvironmentTests { assertThat(sources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)), equalTo(0)); assertThat(sources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)), equalTo(1)); assertThat(sources.precedenceOf(PropertySource.named(JndiPropertySource.JNDI_PROPERTY_SOURCE_NAME)), equalTo(2)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(3)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(4)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(3)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(4)); assertThat(sources.size(), is(5)); System.clearProperty(JndiPropertySource.JNDI_PROPERTY_SOURCE_ENABLED_FLAG); @@ -65,8 +65,8 @@ public class DefaultWebEnvironmentTests { assertThat(sources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)), equalTo(0)); assertThat(sources.precedenceOf(PropertySource.named(DefaultWebEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)), equalTo(1)); //assertThat(sources.precedenceOf(PropertySource.named(JndiPropertySource.JNDI_PROPERTY_SOURCE_NAME)), equalTo(2)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(2)); - assertThat(sources.precedenceOf(PropertySource.named(DefaultEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(3)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(2)); + assertThat(sources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(3)); assertThat(sources.size(), is(4)); System.clearProperty(JndiPropertySource.JNDI_PROPERTY_SOURCE_ENABLED_FLAG);