Solved WW-3402 - memory leak

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@920892 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2010-03-09 14:23:07 +00:00
parent 1cad6648ea
commit e0f3e7f073
@@ -28,18 +28,22 @@ import org.springframework.web.context.WebApplicationContext;
* Base class for Spring JUnit actions
*/
public abstract class StrutsSpringTestCase extends StrutsTestCase {
private static final String DEFAULT_CONTEXT_LOCATION = "classpath*:applicationContext.xml";
protected static ApplicationContext applicationContext;
protected void setupBeforeInitDispatcher() throws Exception {
//init context
GenericXmlContextLoader xmlContextLoader = new GenericXmlContextLoader();
applicationContext = xmlContextLoader.loadContext(getContextLocations());
// only load beans from spring once
if (applicationContext == null) {
GenericXmlContextLoader xmlContextLoader = new GenericXmlContextLoader();
applicationContext = xmlContextLoader.loadContext(getContextLocations());
}
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
}
protected String getContextLocations() {
return DEFAULT_CONTEXT_LOCATION;
}
}