Skip to content

Commit ad29a23

Browse files
committed
PropertyPlaceholderConfigurer is compatible with Spring 2.5 extensions such as GigaSpaces again (SPR-6514)
1 parent 3ffc2ba commit ad29a23

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

org.springframework.beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,12 @@ public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansExcept
387387
this.bfgInstancesByKey.remove(this.resourceLocation);
388388
this.bfgInstancesByObj.remove(groupContext);
389389
throw new BootstrapException("Unable to initialize group definition. " +
390-
"Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]", ex);
390+
"Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]", ex);
391391
}
392392
}
393393

394394
try {
395-
BeanFactory beanFactory = null;
395+
BeanFactory beanFactory;
396396
if (factoryKey != null) {
397397
beanFactory = bfg.definition.getBean(factoryKey, BeanFactory.class);
398398
}

org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java

+18-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.beans.factory.config;
1818

1919
import java.util.Properties;
20+
import java.util.Set;
2021

2122
import org.springframework.beans.BeansException;
2223
import org.springframework.beans.factory.BeanDefinitionStoreException;
@@ -352,12 +353,25 @@ protected String resolveSystemProperty(String key) {
352353
}
353354
}
354355

355-
356356
/**
357-
* BeanDefinitionVisitor that resolves placeholders in String values,
358-
* delegating to the <code>parseStringValue</code> method of the
359-
* containing class.
357+
* Parse the given String value for placeholder resolution.
358+
* @param strVal the String value to parse
359+
* @param props the Properties to resolve placeholders against
360+
* @param visitedPlaceholders the placeholders that have already been visited
361+
* during the current resolution attempt (ignored in this version of the code)
362+
* @deprecated as of Spring 3.0, in favor of using {@link #resolvePlaceholder}
363+
* with {@link org.springframework.util.PropertyPlaceholderHelper}.
364+
* Only retained for compatibility with Spring 2.5 extensions.
360365
*/
366+
@Deprecated
367+
protected String parseStringValue(String strVal, Properties props, Set visitedPlaceholders) {
368+
PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
369+
placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders);
370+
PlaceholderResolver resolver = new PropertyPlaceholderConfigurerResolver(props);
371+
return helper.replacePlaceholders(strVal, resolver);
372+
}
373+
374+
361375
private class PlaceholderResolvingStringValueResolver implements StringValueResolver {
362376

363377
private final PropertyPlaceholderHelper helper;

0 commit comments

Comments
 (0)