With the Hierarchicalbeanfactory interface, Spring's IOC container can establish a parent-child hierarchical association of containers that can access the beans in the parent container, but the parent container cannot access the child container's beans. Within a container, the bean's ID must be unique, but the child container can have a bean with the same ID as the parent container. The parent-child container hierarchy enhances the extensibility and flexibility of the spring container architecture, because a third party can programmatically add one or more special-purpose sub-containers to an existing container to provide some additional functionality.
Spring uses parent-child containers for many functions, such as in spring MVC, where the presentation layer bean is in a child container, while the business layer and the persistence layer's beans are in the parent container. In this way, the presentation layer bean can refer to the business layer and the persistence layer of the bean, while the business layer and the persistence layer bean will not see the presentation layer of beans.
Spring Parent-child container