Spring原始碼閱讀-BeanFactory子介面HierarchicalBeanFactory註釋翻譯
阿新 • • 發佈:2019-02-18
package org.springframework.beans.factory;
/**
* Sub-interface implemented by bean factories that can be part
* of a hierarchy.
*
* 可以被作為分層結構中的一部分的bean工廠實現
*
* <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.
*
* 那些允許以配置的方式設定其父工廠的bean工廠對應的方法setParentBeanFactory可以在介面setParentBeanFactory
* 中找到
*
* @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.
* 返回其父工廠,如果沒有返回Null
*/
BeanFactory getParentBeanFactory();
/**
* Return whether the local bean factory contains a bean of the given name,
* ignoring beans defined in ancestor contexts.
*
* 返回當前bean工廠上下文是否存在給定bean名字的bean,忽略定義在其繼承層次中的工廠上下文。
*
* <p>This is an alternative to {@code containsBean}, ignoring a bean
* of the given name from an ancestor bean factory.
*
* containsBean方法與此方法是二選一的,都忽略其繼承層次中的bean定義,只在當前層次中查詢
*
* @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
*/
boolean containsLocalBean(String name);
}