diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java index 1656fcf12c..2bdc1e5e5b 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java @@ -387,12 +387,12 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator { this.bfgInstancesByKey.remove(this.resourceLocation); this.bfgInstancesByObj.remove(groupContext); throw new BootstrapException("Unable to initialize group definition. " + - "Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]", ex); + "Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]", ex); } } try { - BeanFactory beanFactory = null; + BeanFactory beanFactory; if (factoryKey != null) { beanFactory = bfg.definition.getBean(factoryKey, BeanFactory.class); } diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java index 0c5a3170e2..4fa46be645 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java @@ -17,6 +17,7 @@ package org.springframework.beans.factory.config; import java.util.Properties; +import java.util.Set; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanDefinitionStoreException; @@ -352,12 +353,25 @@ public class PropertyPlaceholderConfigurer extends PropertyResourceConfigurer } } - /** - * BeanDefinitionVisitor that resolves placeholders in String values, - * delegating to the parseStringValue method of the - * containing class. + * Parse the given String value for placeholder resolution. + * @param strVal the String value to parse + * @param props the Properties to resolve placeholders against + * @param visitedPlaceholders the placeholders that have already been visited + * during the current resolution attempt (ignored in this version of the code) + * @deprecated as of Spring 3.0, in favor of using {@link #resolvePlaceholder} + * with {@link org.springframework.util.PropertyPlaceholderHelper}. + * Only retained for compatibility with Spring 2.5 extensions. */ + @Deprecated + protected String parseStringValue(String strVal, Properties props, Set visitedPlaceholders) { + PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper( + placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); + PlaceholderResolver resolver = new PropertyPlaceholderConfigurerResolver(props); + return helper.replacePlaceholders(strVal, resolver); + } + + private class PlaceholderResolvingStringValueResolver implements StringValueResolver { private final PropertyPlaceholderHelper helper;