KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > guice > spring > WebApplicationContextLoader


1 package org.directwebremoting.guice.spring;
2
3 import javax.servlet.ServletContext JavaDoc;
4
5 import org.springframework.beans.factory.BeanFactory;
6 import org.springframework.web.context.ContextLoader;
7 import org.springframework.web.context.WebApplicationContext;
8 import org.springframework.web.context.support.WebApplicationContextUtils;
9
10 /**
11  * A BeanFactory loader that loads a WebApplicationContext given a servlet context.
12  */

13 public class WebApplicationContextLoader implements BeanFactoryLoader
14 {
15     public WebApplicationContextLoader(ServletContext JavaDoc servletContext)
16     {
17         this.servletContext = servletContext;
18     }
19
20     public BeanFactory loadBeanFactory()
21     {
22         new ContextLoader().initWebApplicationContext(servletContext);
23         return WebApplicationContextUtils.getWebApplicationContext(servletContext);
24     }
25     
26     private final ServletContext JavaDoc servletContext;
27 }
28
Popular Tags