Spring Parent-child container

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.