Tightened StringValueResolver contract
Issue: SPR-14842
This commit is contained in:
@@ -370,8 +370,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||||||
}
|
}
|
||||||
catch (TypeMismatchException ex) {
|
catch (TypeMismatchException ex) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Failed to convert bean '" + name + "' to required type [" +
|
logger.debug("Failed to convert bean '" + name + "' to required type '" +
|
||||||
ClassUtils.getQualifiedName(requiredType) + "]", ex);
|
ClassUtils.getQualifiedName(requiredType) + "'", ex);
|
||||||
}
|
}
|
||||||
throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());
|
throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());
|
||||||
}
|
}
|
||||||
@@ -803,12 +803,15 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String resolveEmbeddedValue(String value) {
|
public String resolveEmbeddedValue(String value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String result = value;
|
String result = value;
|
||||||
for (StringValueResolver resolver : this.embeddedValueResolvers) {
|
for (StringValueResolver resolver : this.embeddedValueResolvers) {
|
||||||
|
result = resolver.resolveStringValue(result);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
result = resolver.resolveStringValue(result);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ public interface StringValueResolver {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the given String value, for example parsing placeholders.
|
* Resolve the given String value, for example parsing placeholders.
|
||||||
* @param strVal the original String value
|
* @param strVal the original String value (never {@code null})
|
||||||
* @return the resolved String value
|
* @return the resolved String value (may be {@code null} when resolved to a null
|
||||||
|
* value), possibly the original String value itself (in case of no placeholders
|
||||||
|
* to resolve or when ignoring unresolvable placeholders)
|
||||||
|
* @throws IllegalArgumentException in case of an unresolvable String value
|
||||||
*/
|
*/
|
||||||
String resolveStringValue(String strVal);
|
String resolveStringValue(String strVal);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user