JAVA/Framework

[spring] WebApplicationContext 가져올때 ....

tornado 2005. 3. 5. 11:36

The documented method of obtaining a reference to the WebApplication context is:

Code:
  WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);



Unfortunately, this does not work when using the Struts ContextLoaderPlugIn. The workaround is the following:

Code:
WebApplicationContext webApplicationContext = (WebApplicationContext)
        servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX);



Can the ContextLoaderPlugIn be modified to support the documented method? It should be a simple one-line change and would have saved a lot of time.

포럼 보다가.. 가져옴..