How is Spring actually bootstrap?

前端 未结 2 721
栀梦
栀梦 2020-12-04 12:52
  1. Does anybody know how Spring is actually bootstraps?
  2. Which instances created and by whom?
  3. I really want to know who creates instances of WebApplica
2条回答
  •  天涯浪人
    2020-12-04 13:18

    See http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/htmlsingle/#context-create.

    The principle is to declare a ServletContextListener in the standard webapp descriptor (web.xml). Such a listener is indeed instantiated by the container and is called when the application is initialized and when it's destroyed.

    Spring provides such a ServletContextListener: ContextLoaderListener which, as its name indicates, loads a Spring context when the webapp is initialized.

提交回复
热议问题