提交 fc361844 编写于 作者: J Juergen Hoeller

Polishing

Issue: SPR-11297
上级 52d050d2
......@@ -51,8 +51,8 @@ import org.springframework.util.Assert;
* <p>Enable debug- or trace-level logging for this class (or package) for messages
* explaining when these 'property name resolutions' occur.
*
* <p>This property source is included by default in {@link StandardEnvironment} and all
* its subclasses.
* <p>This property source is included by default in {@link StandardEnvironment}
* and all its subclasses.
*
* @author Chris Beams
* @since 3.1
......@@ -76,7 +76,7 @@ public class SystemEnvironmentPropertySource extends MapPropertySource {
*/
@Override
public boolean containsProperty(String name) {
return getProperty(name) != null;
return (getProperty(name) != null);
}
/**
......@@ -89,9 +89,8 @@ public class SystemEnvironmentPropertySource extends MapPropertySource {
Assert.notNull(name, "property name must not be null");
String actualName = resolvePropertyName(name);
if (logger.isDebugEnabled() && !name.equals(actualName)) {
logger.debug(String.format(
"PropertySource [%s] does not contain '%s', but found equivalent '%s'",
this.getName(), name, actualName));
logger.debug(String.format("PropertySource [%s] does not contain '%s', but found equivalent '%s'",
getName(), name, actualName));
}
return super.getProperty(actualName);
}
......@@ -115,7 +114,8 @@ public class SystemEnvironmentPropertySource extends MapPropertySource {
if (!name.equals(ucName)) {
if (super.containsProperty(ucName)) {
return ucName;
} else {
}
else {
String usUcName = ucName.replace('.', '_');
if (!ucName.equals(usUcName) && super.containsProperty(usUcName)) {
return usUcName;
......
......@@ -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);
......
......@@ -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
......
/*
* 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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册