When the spring framework initializes the spring context, it sets the parent, for that context. I would like to ask what this parent is.

the code snippet is as follows:

if (this.context instanceof ConfigurableWebApplicationContext) {
    ConfigurableWebApplicationContext cwac = (ConfigurableWebApplicationContext)this.context;
    if (!cwac.isActive()) {
       if (cwac.getParent() == null) {
              **ApplicationContext parent = this.loadParentContext(servletContext);
              cwac.setParent(parent);**
       }
       this.configureAndRefreshWebApplicationContext(cwac, servletContext);
    }
}

is mainly what the this.loadParentContext (servletContext) method actually gets, and then sets it as the parent context of the spring context. In my understanding, the container of the spring context is already a top-level container, how can there be a father?

Mar.16,2021
Menu