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 019import org.springframework.lang.Nullable; 020 021/** 022 * Sub-interface implemented by bean factories that can be part 023 * of a hierarchy. 024 * 025 * <p>The corresponding {@code setParentBeanFactory} method for bean 026 * factories that allow setting the parent in a configurable 027 * fashion can be found in the ConfigurableBeanFactory interface. 028 * 029 * @author Rod Johnson 030 * @author Juergen Hoeller 031 * @since 07.07.2003 032 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory 033 */ 034public interface HierarchicalBeanFactory extends BeanFactory { 035 036 /** 037 * Return the parent bean factory, or {@code null} if there is none. 038 */ 039 @Nullable 040 BeanFactory getParentBeanFactory(); 041 042 /** 043 * Return whether the local bean factory contains a bean of the given name, 044 * ignoring beans defined in ancestor contexts. 045 * <p>This is an alternative to {@code containsBean}, ignoring a bean 046 * of the given name from an ancestor bean factory. 047 * @param name the name of the bean to query 048 * @return whether a bean with the given name is defined in the local factory 049 * @see BeanFactory#containsBean 050 */ 051 boolean containsLocalBean(String name); 052 053}