Class BeanDefinitionValueResolver
java.lang.Object
org.springframework.beans.factory.support.BeanDefinitionValueResolver
Helper class for use in bean factory implementations,
 resolving values contained in bean definition objects
 into the actual values applied to the target bean instance.
 
Operates on an AbstractBeanFactory and a plain
 BeanDefinition object.
 Used by AbstractAutowireCapableBeanFactory.
- Since:
- 1.2
- Author:
- Juergen Hoeller, Sam Brannen, Stephane Nicoll
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBeanDefinitionValueResolver(AbstractAutowireCapableBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition) Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition using a defaultTypeConverter.BeanDefinitionValueResolver(AbstractAutowireCapableBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition, TypeConverter typeConverter) Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition, using the givenTypeConverter.
- 
Method SummaryModifier and TypeMethodDescriptionEvaluate the given value as an expression, if necessary.evaluate(TypedStringValue value) Evaluate the given value as an expression, if necessary.<T> TresolveInnerBean(@Nullable String innerBeanName, BeanDefinition innerBd, BiFunction<String, RootBeanDefinition, T> resolver) Resolve an inner bean definition and invoke the specifiedresolveron its merged bean definition.Resolve the target type in the given TypedStringValue.resolveValueIfNecessary(Object argName, @Nullable Object value) Given a PropertyValue, return a value, resolving any references to other beans in the factory if necessary.
- 
Constructor Details- 
BeanDefinitionValueResolverpublic BeanDefinitionValueResolver(AbstractAutowireCapableBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition, TypeConverter typeConverter) Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition, using the givenTypeConverter.- Parameters:
- beanFactory- the BeanFactory to resolve against
- beanName- the name of the bean that we work on
- beanDefinition- the BeanDefinition of the bean that we work on
- typeConverter- the TypeConverter to use for resolving TypedStringValues
 
- 
BeanDefinitionValueResolverpublic BeanDefinitionValueResolver(AbstractAutowireCapableBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition) Create a BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition using a defaultTypeConverter.- Parameters:
- beanFactory- the BeanFactory to resolve against
- beanName- the name of the bean that we work on
- beanDefinition- the BeanDefinition of the bean that we work on
 
 
- 
- 
Method Details- 
resolveValueIfNecessaryGiven a PropertyValue, return a value, resolving any references to other beans in the factory if necessary. The value could be:
- A BeanDefinition, which leads to the creation of a corresponding new bean instance. Singleton flags and names of such "inner beans" are always ignored: Inner beans are anonymous prototypes.
- A RuntimeBeanReference, which must be resolved.
- A ManagedList. This is a special collection that may contain RuntimeBeanReferences or Collections that will need to be resolved.
- A ManagedSet. May also contain RuntimeBeanReferences or Collections that will need to be resolved.
- A ManagedMap. In this case the value may be a RuntimeBeanReference or Collection that will need to be resolved.
- An ordinary object or
null, in which case it's left alone.- Parameters:
- argName- the name of the argument that the value is defined for
- value- the value object to resolve
- Returns:
- the resolved object
 
- 
resolveInnerBeanpublic <T> T resolveInnerBean(@Nullable String innerBeanName, BeanDefinition innerBd, BiFunction<String, RootBeanDefinition, T> resolver) Resolve an inner bean definition and invoke the specifiedresolveron its merged bean definition.- Type Parameters:
- T- the type of the resolution
- Parameters:
- innerBeanName- the inner bean name (or- nullto assign one)
- innerBd- the inner raw bean definition
- resolver- the function to invoke to resolve
- Returns:
- a resolved inner bean, as a result of applying the resolver
- Since:
- 6.0
 
- 
evaluateEvaluate the given value as an expression, if necessary.- Parameters:
- value- the candidate value (may be an expression)
- Returns:
- the resolved value
 
- 
evaluateEvaluate the given value as an expression, if necessary.- Parameters:
- value- the original value (may be an expression)
- Returns:
- the resolved value if necessary, or the original value
 
- 
resolveTargetTypeprotected @Nullable Class<?> resolveTargetType(TypedStringValue value) throws ClassNotFoundException Resolve the target type in the given TypedStringValue.- Parameters:
- value- the TypedStringValue to resolve
- Returns:
- the resolved target type (or nullif none specified)
- Throws:
- ClassNotFoundException- if the specified type cannot be resolved
- See Also:
 
 
-