springmvc-servlet.xml,applicationContext.xml 哪个先被加载

                  springmvc-servlet.xml,applicationContext.xml 哪个先被加载

 

1、applicationContext.xml是随ContextLoaderListener的加载而执行的,而xxx-servlet.xml是随DispatcherServlet的加载而执行的,在web.xml中;

2、加载顺序是listener>filter>servlet;

3、applicationContext.xml先加载!

 

先看web.xml配置

默认去找一个applicationContext.xml 的文件

为什么?

 

然后默认去找一个*-servlet.xml的文件

为什么?

 

 

 

Spring MVC 原理

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章