ContextLoaderListener的说明

ContextLoaderListener是配置在web.xml里的,具体如下:

 <!--
    ContextLoaderListener是个监听器,用来监听容器启动事件,监听到容器启动事件后
    其contextInitialized方法会被调用,在这个方法中,spring会初始化一个启动上下文
    -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

ContextLoaderListener是一个监听器,用来监听容器启动事件,监听到容器启动事件后,会调用其contextInitialized(ServletContextEvent event)方法,该方法负责完成IOC容器在Web环境中的启动工作,负责在容器启动后初始化IOC容器(会调用AbstractApplicationContext.refresh()方法)。

 

posted @ 2019-04-12 22:06  不停的奋斗  阅读(646)  评论(0编辑  收藏  举报