Skip to main content


Showing posts from January, 2012

Spring Framework : ApplicationContext instantiation for web applications in Spring Framework

In web application ApplicationContext is created using Context Loaders. there are two implementations of context loader. ContextLoaderListener : It is listener implementation that is added to web.xml file. ContextLoaderServlet : It is servlet implementation that is configured with load-on-startup tag in web.xml.   ContextLoaderListener is simple way to use the spring in web application. this listener accept contextConfigLocation parameter from context-parama. You have to enter following code in web.xml file define contextConfigLocation parameter in context-param tag. <context-param>   <param-name>contextConfigLocation</param-name>   <param-value>/WEB-INF/services.xml</param-value> </context-param>   services.xml is the Spring configuration file in which you define beans. Add the ContextLoaderListener listener. <listener>   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </li