Polishing

Issue: SPR-11297
(cherry picked from commit fc36184)
This commit is contained in:
Juergen Hoeller
2014-01-22 23:57:48 +01:00
parent 6793765b0a
commit 9c3a972dac
4 changed files with 16 additions and 17 deletions

View File

@@ -186,18 +186,17 @@ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWe
@Override
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
AnnotatedBeanDefinitionReader reader = new AnnotatedBeanDefinitionReader(beanFactory);
reader.setEnvironment(this.getEnvironment());
reader.setEnvironment(getEnvironment());
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(beanFactory);
scanner.setEnvironment(this.getEnvironment());
scanner.setEnvironment(getEnvironment());
BeanNameGenerator beanNameGenerator = getBeanNameGenerator();
ScopeMetadataResolver scopeMetadataResolver = getScopeMetadataResolver();
if (beanNameGenerator != null) {
reader.setBeanNameGenerator(beanNameGenerator);
scanner.setBeanNameGenerator(beanNameGenerator);
beanFactory.registerSingleton(
AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR, beanNameGenerator);
beanFactory.registerSingleton(AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR, beanNameGenerator);
}
if (scopeMetadataResolver != null) {
reader.setScopeMetadataResolver(scopeMetadataResolver);

View File

@@ -67,10 +67,10 @@ public class StandardServletEnvironment extends StandardEnvironment implements C
* {@value #JNDI_PROPERTY_SOURCE_NAME}.
* <p>Properties in any of the above will take precedence over system properties and
* environment variables contributed by the {@link StandardEnvironment} superclass.
* <p>The {@code Servlet}-related property sources are added as {@link
* StubPropertySource stubs} at this stage, and will be {@linkplain
* #initPropertySources(ServletContext, ServletConfig) fully initialized} once the actual
* {@link ServletContext} object becomes available.
* <p>The {@code Servlet}-related property sources are added as
* {@link StubPropertySource stubs} at this stage, and will be
* {@linkplain #initPropertySources(ServletContext, ServletConfig) fully initialized}
* once the actual {@link ServletContext} object becomes available.
* @see StandardEnvironment#customizePropertySources
* @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see ServletConfigPropertySource

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2013 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.
@@ -84,7 +84,7 @@ public class XmlWebApplicationContext extends AbstractRefreshableWebApplicationC
// Configure the bean definition reader with this context's
// resource loading environment.
beanDefinitionReader.setEnvironment(this.getEnvironment());
beanDefinitionReader.setEnvironment(getEnvironment());
beanDefinitionReader.setResourceLoader(this);
beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));