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

xiaoxiao2025-09-14  189

                  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 原理

wangxiaoming 认证博客专家 架构 Spring Boot Redis 博客是很好的总结和记录工具,如果有问题,来不及回复,关注微信公众号:程序员开发者社区,获取我的联系方式,向我提问,也可以给我发送邮件,联系 1275801617@qq.com
转载请注明原文地址: https://www.6miu.com/read-5036308.html

最新回复(0)