I am trying to understand ApplicationContext hierarchies in spring.
I learned the following
- An ApplicationContext cannot have more than 1 parent ApplicationContext.
- When a given ApplicationContext cannot resolve a bean, it will pass on the resolution request to its parent.
- The parent of an ApplicationContext is specified in its constructor.
I would like to understand when to use ApplicationContext hierarchies (instead of a single ApplicationContext).
The best I could get from google was this. And what I understand is that if an application has a large number of beans defined at the various layers then each layer having its own ApplicationContext would be a benefit. What is not understood is what is the benefit of doing so and how is the benefit achieved?