PropertyPlaceholderConfigurer is compatible with Spring 2.5 extensions such as GigaSpaces again (SPR-6514)

This commit is contained in:
Juergen Hoeller 2009-12-09 16:09:12 +00:00
parent 3ffc2ba48d
commit ad29a2376d
2 changed files with 20 additions and 6 deletions

View File

@ -392,7 +392,7 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
} }
try { try {
BeanFactory beanFactory = null; BeanFactory beanFactory;
if (factoryKey != null) { if (factoryKey != null) {
beanFactory = bfg.definition.getBean(factoryKey, BeanFactory.class); beanFactory = bfg.definition.getBean(factoryKey, BeanFactory.class);
} }

View File

@ -17,6 +17,7 @@
package org.springframework.beans.factory.config; package org.springframework.beans.factory.config;
import java.util.Properties; import java.util.Properties;
import java.util.Set;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.BeanDefinitionStoreException;
@ -352,12 +353,25 @@ public class PropertyPlaceholderConfigurer extends PropertyResourceConfigurer
} }
} }
/** /**
* BeanDefinitionVisitor that resolves placeholders in String values, * Parse the given String value for placeholder resolution.
* delegating to the <code>parseStringValue</code> method of the * @param strVal the String value to parse
* containing class. * @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 class PlaceholderResolvingStringValueResolver implements StringValueResolver {
private final PropertyPlaceholderHelper helper; private final PropertyPlaceholderHelper helper;