Rename {Default=>Standard}Environment
Issue: SPR-8348
This commit is contained in:
@@ -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.
|
||||
* <p>The default is a {@link DefaultEnvironment}.
|
||||
* <p>The default is a {@link StandardEnvironment}.
|
||||
* @see #registerBean(Class, String, Class...)
|
||||
*/
|
||||
public void setEnvironment(Environment environment) {
|
||||
|
||||
@@ -91,8 +91,9 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
|
||||
* {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}.
|
||||
* <p>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
|
||||
|
||||
@@ -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.
|
||||
* <p>The default is a {@link DefaultEnvironment}
|
||||
* <p>The default is a {@link StandardEnvironment}
|
||||
* @param environment the Environment to use
|
||||
*/
|
||||
public void setEnvironment(Environment environment) {
|
||||
|
||||
@@ -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}.
|
||||
* <p>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 {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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<BeanDefinition> 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<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user