mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user