Saturday, February 8, 2014

Activation of Spring Container in Web Application

                                           
One of the ways to Activate Spring 'ApplicationContext'  Container is
First Configure the Spring configuration file in web.xml file
eg:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/Spring.cfg.xml</param-value>
</context-param>


and next Configure the ContextLoaderListener

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
      </listener-class>
</listener>


and finally in Servlet


ApplicationContext context=WebApplicationContextUtils.
getRequiredWebApplicationContext(config.getServletContext());


It is Done. Now ApplicationContext Container will be Activated.

0 comments:

Post a Comment