001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.beans.factory; 018 019/** 020 * Sub-interface implemented by bean factories that can be part 021 * of a hierarchy. 022 * 023 * <p>The corresponding {@code setParentBeanFactory} method for bean 024 * factories that allow setting the parent in a configurable 025 * fashion can be found in the ConfigurableBeanFactory interface. 026 * 027 * @author Rod Johnson 028 * @author Juergen Hoeller 029 * @since 07.07.2003 030 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory 031 */ 032public interface HierarchicalBeanFactory extends BeanFactory { 033 034 /** 035 * Return the parent bean factory, or {@code null} if there is none. 036 */ 037 BeanFactory getParentBeanFactory(); 038 039 /** 040 * Return whether the local bean factory contains a bean of the given name, 041 * ignoring beans defined in ancestor contexts. 042 * <p>This is an alternative to {@code containsBean}, ignoring a bean 043 * of the given name from an ancestor bean factory. 044 * @param name the name of the bean to query 045 * @return whether a bean with the given name is defined in the local factory 046 * @see BeanFactory#containsBean 047 */ 048 boolean containsLocalBean(String name); 049 050}