Make the class reloading implementation work with convention. (use the reloading class loader when an instance is requested using the class name)

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@794116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Musachy Barroso
2009-07-14 23:44:43 +00:00
parent 4eb9f31c67
commit 0fd40525cd
2 changed files with 9 additions and 0 deletions
@@ -209,4 +209,8 @@ public class ClassReloadingXMLWebApplicationContext extends XmlWebApplicationCon
public void onStop(FilesystemAlterationObserver filesystemAlterationObserver) {
}
public ReloadingClassLoader getReloadingClassLoader() {
return classLoader;
}
}
@@ -92,10 +92,15 @@ public class StrutsSpringObjectFactory extends SpringObjectFactory {
if ("true".equals(devMode)
&& StringUtils.isNotBlank(watchList)
&& appContext instanceof ClassReloadingXMLWebApplicationContext) {
//prevent class caching
useClassCache = false;
ClassReloadingXMLWebApplicationContext reloadingContext = (ClassReloadingXMLWebApplicationContext) appContext;
reloadingContext.setupReloading(watchList.split(","), acceptClasses, servletContext);
LOG.info("Class reloading is enabled. Make sure this is not used on a production environment!", watchList);
setClassLoader(reloadingContext.getReloadingClassLoader());
//we need to reload the context, so our isntance of the factory is picked up
reloadingContext.refresh();
}