首先引用一段对Spring Container Hierarchy的理解
[quote]The Spring framework is used as a general application framework. The objects making up the application are being wired up by the Spring framework based on a number of XML configuration files, generally one per layer. The Spring ContextSingletonBeanFactoryLocator class is used to create multiple hierarchical Spring IoC container instances, also called bean factory or application context in Spring parlance, from these XML configuration files. For the container of each layer, the container of the lower layer is the parent container.
[img]http://www.mod4j.org/documentation/1.0.0/application-architecture/images/spring-config.jpg[/img]
Beans defined in a direct or indirect parent context are visible in the child context, but not vice versa. This hierarchical container is then used as the parent container of a web application container. In this way, containers and the beans contained in them, may be shared between several web applications, and loaded only once. Moreover, the hierarchical composition of the container guarantees that dependencies between them are parallel to the depencencies between the layers of the logical view. See section 3.9 Glue code and the evil singleton in [Spring25] and the Javadoc for ContextSingletonBeanFactoryLocator for more details.[/quote]
源自:[url]http://www.mod4j.org/documentation/1.0.0/application-architecture/mod4j-application-architecture.html[/url](Part 3.3)
Spring container hierarchy 的特点如下:
1. 该hierarchy是树形结构,即任意一个child container 都只能有一个parent container,不允许多重继承的存在;
2.
3.
[quote]The Spring framework is used as a general application framework. The objects making up the application are being wired up by the Spring framework based on a number of XML configuration files, generally one per layer. The Spring ContextSingletonBeanFactoryLocator class is used to create multiple hierarchical Spring IoC container instances, also called bean factory or application context in Spring parlance, from these XML configuration files. For the container of each layer, the container of the lower layer is the parent container.
[img]http://www.mod4j.org/documentation/1.0.0/application-architecture/images/spring-config.jpg[/img]
Beans defined in a direct or indirect parent context are visible in the child context, but not vice versa. This hierarchical container is then used as the parent container of a web application container. In this way, containers and the beans contained in them, may be shared between several web applications, and loaded only once. Moreover, the hierarchical composition of the container guarantees that dependencies between them are parallel to the depencencies between the layers of the logical view. See section 3.9 Glue code and the evil singleton in [Spring25] and the Javadoc for ContextSingletonBeanFactoryLocator for more details.[/quote]
源自:[url]http://www.mod4j.org/documentation/1.0.0/application-architecture/mod4j-application-architecture.html[/url](Part 3.3)
Spring container hierarchy 的特点如下:
1. 该hierarchy是树形结构,即任意一个child container 都只能有一个parent container,不允许多重继承的存在;
2.
3.