To reload all Spring config files without restarting the server at runtime
==> Save time during development



Sam
  ----- Original Message ----- 
  From: Sanjiv Jivan 
  To: [email protected] 
  Sent: Tuesday, April 17, 2007 11:10 AM
  Subject: Re: [appfuse-user] spring 2.0.4 FrameworkServlet.refresh()


  Maybe I'm missing something here, but why is the call to refresh() in the 
StartupListener?


  On 4/16/07, j2ee dodo < [EMAIL PROTECTED]> wrote:
    Hi gang,

    spring 2.0.4 FrameworkServlet.refresh () is supposedly able to refresh 
Spring
    config
    files at runtime(correct me if wrong), so I  did something like below in
    StartupListener.setupContext(...)


    public static void setupContext(ServletContext context) { 
            ApplicationContext ctx =
                
WebApplicationContextUtils.getRequiredWebApplicationContext(context);

            LookupManager mgr = (LookupManager) ctx.getBean("lookupManager");

            // get list of possible roles 
            context.setAttribute(Constants.AVAILABLE_ROLES, mgr.getAllRoles());

            if (log.isDebugEnabled()) {
                log.debug("Drop-down initialization complete [OK]");
            }

            // code taken from FrameworkServlet.refresh() of Spring 2.0.4
            if (!(ctx instanceof ConfigurableApplicationContext)) {
               throw new IllegalStateException("WebApplicationContext does not
    support refresh: " + ctx);
            }
            ((ConfigurableApplicationContext) ctx).refresh();

              log.warn("Refresh Spring config files complete.");
              System.out.println("Refresh Spring config files complete."); 

        }

    change Spring config files, then login to call reload from menu, yet it
    doesn't seem to work

    Did anyone get it to work???

    Thanks,

    Sam


    --------------------------------------------------------------------- 
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    For additional commands, e-mail: [EMAIL PROTECTED] 



Reply via email to