Spring技术内幕笔记(八)------对Bean Reference的解析

在上篇文章中我们了解到了如何设置Bean之间的依赖关系,以及如何将一个Bean设置到它所依赖的另一个bean的属性中,但是我们还忘了一步,就是对BeanDefinition进行解析,在Spring中是通过BeanDefinitionResolver来对BeanDefinition进行解析的。

在populateBean()会创建一个BeanDefinitionValueResolver对象,然后调用BeanDefinitionValueResolver#resolveValueNecessary方法来对BeanDefinition进行解析,根本上其实是对一个propertyValue进行解析。

/**
	 * Given a PropertyValue, return a value, resolving any references to other
	 * beans in the factory if necessary.
	 给定一个PropertyValue,返回一个值,如果有必要,解析对工厂中其他bean的任何引用
	 The value could be:
	 这个value可以是
	 * <li>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.
BeanDefinition,它导致创建相应的新bean实例。 Singleton标志和这种“内部bean”的名称总是被忽略:内部bean是匿名原型。
	 * <li>A RuntimeBeanReference, which must be resolved.
	 一个RuntimeBeanReference,必须解析
	 * <li>A ManagedList. This is a special collection that may contain
	 * RuntimeBeanReferences or Collections that will need to be resolved.
	 一个managedList,这是一个特殊的集合,可能包含需要解析的RuntimeBeanReference或者Collections
	 * <li>A ManagedSet. May also contain RuntimeBeanReferences or
	 * Collections that will need to be resolved.
	 一个ManagedSet。也可能包含RunTimeBeanReference或需要解决的集合
	 一个ManagedSet,
	 * <li>A ManagedMap. In this case the value may be a RuntimeBeanReference
	 * or Collection that will need to be resolved.
	 一个Managed
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值