HierarchicalBeanFactory:HierarchicalBeanFactory继承BeanFactory并扩展使其支持层级结构。getParentBeanFactory()方法或者父级BeanFactory,containsLocalBean(String name)方法查看当前BeanFactory是否包含给定名字的Bean,不会递归想父级查找。


HierarchicalBeanFactory源码具体:

  1、第一个方法返回本Bean工厂的父工厂。这个方法实现了工厂的分层。

  2、第二个方法判断本地工厂是否包含这个Bean(忽略其他所有父工厂)。这也是分层思想的体现。

总结:这个工厂接口非常简单,实现了Bean工厂的分层。这个工厂接口也是继承自BeanFacotory,也是一个二级接口,相对于父接口,它只扩展了一个重要的功能——工厂分层。

/**
* Sub-interface implemented by bean factories that can be part
* of a hierarchy.
*
* <p>The corresponding {@code setParentBeanFactory} method for bean
* factories that allow setting the parent in a configurable
* fashion can be found in the ConfigurableBeanFactory interface.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @since 07.07.2003
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory
*/
public interface HierarchicalBeanFactory extends BeanFactory { /**
* Return the parent bean factory, or {@code null} if there is none.
*/
//返回本Bean工厂的父工厂
BeanFactory getParentBeanFactory(); /**
* Return whether the local bean factory contains a bean of the given name,
* ignoring beans defined in ancestor contexts.
* <p>This is an alternative to {@code containsBean}, ignoring a bean
* of the given name from an ancestor bean factory.
* @param name the name of the bean to query
* @return whether a bean with the given name is defined in the local factory
* @see BeanFactory#containsBean
*/
//本地工厂(容器)是否包含这个Bean
boolean containsLocalBean(String name); }
 

最新文章

  1. HDU 4669 Mutiples on a circle(环状DP)
  2. Oracle Quality --- Setup Collection Element and Collection Plan
  3. DropBox与Box的区别,包括直接的投资人的评价(本地Sync可能还是挺重要的)
  4. DbUtils类基本使用
  5. sass学习笔记 -- sass的四种编译方法
  6. xml学习_上篇
  7. 提取和匹配线特征的一个demo
  8. python 编码规范 (http://www.runoob.com/w3cnote/google-python-styleguide.html)
  9. 五、es6 Set
  10. java JUC
  11. BZOJ5334 [TJOI2018] 数学计算 【线段树分治】
  12. 2019.03.23 Http
  13. PropertiesUtil 读取properties
  14. 数据结构:Queue
  15. django 认证系统--2
  16. 最近遇到的几个问题,关于Unity脚本在Inspector视图中前面没有勾选框的问题
  17. Git 撤销操作、删除文件和恢复文件
  18. 查看python中已安装的包
  19. 利用PIE实现全球云分布图的效果
  20. C语言俄罗斯方块

热门文章

  1. SpringData :下划线的那些破事
  2. DM-移除几何上的洞方法二
  3. URLEncoder.encode 使用心得
  4. 利用Git上传项目到github以及遇到的问题
  5. mysql 替换函数replace()实现mysql替换指定字段中的字符串
  6. 【转】禁用chrome firefox 的 WebRTC功能防止真实IP泄漏
  7. CMU Database Systems - Indexes
  8. dubbo线程模型配置
  9. 钉钉通知机器人与SpringBoot的集成
  10. 国人开发的api测试工具 ApiPost