do not insist on BeanDefinition presence for @Value resolution (for use in unit tests; SPR-6918)

This commit is contained in:
Juergen Hoeller 2010-03-16 23:47:40 +00:00
parent ff09482653
commit b8c0e153e3
2 changed files with 3 additions and 2 deletions

View File

@ -1242,7 +1242,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (this.beanExpressionResolver == null) {
return value;
}
Scope scope = getRegisteredScope(beanDefinition.getScope());
Scope scope = (beanDefinition != null ? getRegisteredScope(beanDefinition.getScope()) : null);
return this.beanExpressionResolver.evaluate(value, new BeanExpressionContext(this, scope));
}

View File

@ -694,7 +694,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if (value != null) {
if (value instanceof String) {
String strVal = resolveEmbeddedValue((String) value);
value = evaluateBeanDefinitionString(strVal, getMergedBeanDefinition(beanName));
BeanDefinition bd = (containsBean(beanName) ? getMergedBeanDefinition(beanName) : null);
value = evaluateBeanDefinitionString(strVal, bd);
}
TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
return converter.convertIfNecessary(value, type);