/** * Called by the ModuleUtil after adding in a new, updating, starting, or stopping a module. * This needs to be called because each spring dispatcher servlet creates a new application * context, which therefore needs to be refreshed too. * * @throws ServletException */ public void refreshApplicationContext() throws ServletException { log.info("Application context for the static content dispatcher servlet is being refreshed"); Thread.currentThread().setContextClassLoader(OpenmrsClassLoader.getInstance()); ((XmlWebApplicationContext) getWebApplicationContext()).setClassLoader(OpenmrsClassLoader.getInstance()); refresh(); }
/** * Called by the ModuleUtil after adding in a new module. This needs to be called because the * new mappings and advice that a new module adds in are cached by Spring's DispatcherServlet. * This method will reload that cache. * * @throws ServletException */ public void reInitFrameworkServlet() throws ServletException { log.debug("Framework being REinitialized"); Thread.currentThread().setContextClassLoader(OpenmrsClassLoader.getInstance()); ((XmlWebApplicationContext) getWebApplicationContext()).setClassLoader(OpenmrsClassLoader.getInstance()); refresh(); // the spring context gets reset by the framework servlet, so we need to // reload the advice points that were lost when refreshing Spring for (Module module : ModuleFactory.getStartedModules()) { ModuleFactory.loadAdvice(module); } }
@Override protected ConfigurableApplicationContext createApplicationContext(URL url, ClassLoader loader) { final String resourceBases = System.getProperty("resourceBases"); final XmlWebApplicationContext context = resourceBases == null ? new XmlWebApplicationContext() : new DevXmlWebApplicationContext(resourceBases); context.setClassLoader(loader); context.setConfigLocation(url.toExternalForm()); context.setServletContext(servletContext); return context; }
appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[] { contextConfigLocation });
appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[] { "/WEB-INF/red5-*.xml" });
appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[] { "/WEB-INF/red5-*.xml" });