Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web.xml(tomcat) vs ApplicationContext.xml(spring) which loads first?

Am trying to understand the control flow between web.xml and applicationcontext.xml of a web application. Can someone please explain which loads first?

like image 598
RanPaul Avatar asked Dec 26 '22 09:12

RanPaul


1 Answers

Spring MVC is a framework built on top of the Servlet API. As such, it requires a Servlet container.

Your Servlet container finds the web.xml or uses any other deployment strategy (depends on container), finds the Servlet implementations to instantiate (or through @WebServlet) and instantiates them.

One of these Servlet implementations is Spring's DispatcherServlet which, as part of its initialization, generates an ApplicationContext which it then uses to configure its controllers and dispatch requests.

like image 108
Sotirios Delimanolis Avatar answered Feb 24 '23 07:02

Sotirios Delimanolis