Hi all,
I am a bit confused regarding who is created first ,a servlet ,or a servlet context?
According to my logic ,servlet context must be created first.
Please correct me if I am wrong.
Thanks Pravin,
So may i conclue that the servlet is created after the servlet context has been created,and hence a listener class(ContextLoaderListener) will run before a servlet(DispatcherServlet)?
ContextLoaderListener is a Spring class and has nothing to do with Servlets when Spring isn't being used.
If you mean ServletContextListener, then yes, this listener's contextInitialized() method will fire before any servlets are loaded or requests are processed.
Sudhanshu Mishra wrote:Thanks Pravin,
So may i conclue that the servlet is created after the servlet context has been created,and hence a listener class(ContextLoaderListener) will run before a servlet(DispatcherServlet)?