Loading spring context in web application after some servlet -


We started one of our toplets after our web application What is the best way to do this?

I know that it is recommended to use the listener in web.xxx, but it is not really good for us, because in this case the first reference of the first circlet will be loaded. I saw that in this class - ContextLoader Services - in Spring 2.5, but it is absent in spring 3.0. So I think we should write some dummy servlets with the sole purpose of loading the context? Is there a better way?

Thank you.

OK, so if you have this legacy servlet that sets things up, then you Need to persevere to the Spring Servicelet to load.

It's simple - use DispatcherServlet of Spring to load the context of spring, and standard & lt; Load-On-Startup & gt; Use web.xml in , for example

  & lt; Servlet & gt; & Lt; Servlet-name & gt; LegacyServlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Com.xy.LegacyServlet & lt; / Servlet category & gt; & Lt; Load-On-Startup & gt; 0 & lt; / Load-on-startup & gt; & Lt; / Servlet & gt; & Lt; Servlet & gt; & Lt; Servlet-name & gt; SpringServlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Org.springframework.web.servlet.DispatcherServlet & lt; / Servlet category & gt; & Lt; Load-On-Startup & gt; 1 & lt; / Load-on-startup & gt; & Lt; / Servlet & gt;  

Comments