How Spring parent containers and Spring MVC child containers reflect the parent-child relationship

ordinary subclasses inherit the parent class through the extends keyword, so how do the Spring parent container and the Spring MVC child container reflect the parent-child relationship? does the
container refer to a class? which class is the Spring container and which class is the, Spring MVC container?


A container is a context in which people can share something.

when the Spring application starts, it first reads the web.xml file and calls ContextLoaderListener to create the Spring container, which is what you call the parent container.

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

after Listener is created, start creating Servlet:

    <servlet>
        <servlet-name>SpringMVC</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    </servlet>

at this time this DispatcherServlet begins to try to create ApplicationContext of SpringMVC . It first looks for ApplicationContext of Spring created by ContextLoaderListener above, and then passes ApplicationContext of Spring as a parameter to ApplicationContext setParent of DispatcherServlet .

because the Spring parent container of SpringMVC is specified when the child container is created, the son can find the father, so the Bean in the child container SpringMVC can call the service of the parent container, but the parent container does not know that the son exists (an irresponsible father), and the Bean in the parent container cannot call the service in the child container.


presumably there is no need to say much about the relationship between Servlet. Just go to the code
HttpServletBean inherits HttpServlet , and the init method is as follows

.
    @Override
    public final void init() throws ServletException {
        // Let subclasses do whatever initialization they like.
        initServletBean();
    }

look at the subclass FrameworkServlet-sharpinitServletBean method

 

not very clear

< H2 > excuse me, I'm here to find the answer to this question. < / H2 >
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3df7e-2c3e2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3df7e-2c3e2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?