Consistent Environment access in XML bean definition parsing code
Issue: SPR-12248
This commit is contained in:
@@ -103,8 +103,7 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
|
||||
* {@link org.springframework.stereotype.Component @Component},
|
||||
* {@link org.springframework.stereotype.Repository @Repository},
|
||||
* {@link org.springframework.stereotype.Service @Service}, and
|
||||
* {@link org.springframework.stereotype.Controller @Controller} stereotype
|
||||
* annotations.
|
||||
* {@link org.springframework.stereotype.Controller @Controller} stereotype annotations
|
||||
* @see #setResourceLoader
|
||||
* @see #setEnvironment
|
||||
*/
|
||||
@@ -124,13 +123,12 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
|
||||
* @param registry the {@code BeanFactory} to load bean definitions into, in the form
|
||||
* of a {@code BeanDefinitionRegistry}
|
||||
* @param useDefaultFilters whether to include the default filters for the
|
||||
* @param environment the Spring {@link Environment} to use when evaluating bean
|
||||
* definition profile metadata.
|
||||
* {@link org.springframework.stereotype.Component @Component},
|
||||
* {@link org.springframework.stereotype.Repository @Repository},
|
||||
* {@link org.springframework.stereotype.Service @Service}, and
|
||||
* {@link org.springframework.stereotype.Controller @Controller} stereotype
|
||||
* annotations.
|
||||
* {@link org.springframework.stereotype.Controller @Controller} stereotype annotations
|
||||
* @param environment the Spring {@link Environment} to use when evaluating bean
|
||||
* definition profile metadata
|
||||
* @since 3.1
|
||||
* @see #setResourceLoader
|
||||
*/
|
||||
|
||||
@@ -115,6 +115,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||
if (useDefaultFilters) {
|
||||
registerDefaultFilters();
|
||||
}
|
||||
Assert.notNull(environment, "Environment must not be null");
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@@ -161,10 +162,11 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||
/**
|
||||
* Set the Environment to use when resolving placeholders and evaluating
|
||||
* {@link Conditional @Conditional}-annotated component classes.
|
||||
* <p>The default is a {@link StandardEnvironment}
|
||||
* <p>The default is a {@link StandardEnvironment}.
|
||||
* @param environment the Environment to use
|
||||
*/
|
||||
public void setEnvironment(Environment environment) {
|
||||
Assert.notNull(environment, "Environment must not be null");
|
||||
this.environment = environment;
|
||||
this.conditionEvaluator = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user