View Javadoc

1   package com.atlassian.config.spring;
2   
3   import com.atlassian.spring.container.SpringContainerContext;
4   import org.springframework.context.ApplicationContext;
5   import org.springframework.web.context.ContextLoader;
6   import org.springframework.web.context.support.WebApplicationContextUtils;
7   
8   public class BootstrappedContainerContext extends SpringContainerContext
9   {
10      public synchronized void refresh()
11      {
12          ContextLoader loader = new BootstrappedContextLoader();
13  
14          // if we have an existing spring context, ensure we close it properly
15          ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
16  
17          if (ctx != null)
18          {
19              loader.closeWebApplicationContext(getServletContext());
20          }
21  
22          loader.initWebApplicationContext(getServletContext());
23  
24          if (getApplicationContext() == null)
25          {
26              setApplicationContext(WebApplicationContextUtils.getWebApplicationContext(getServletContext()));
27          }
28  
29          contextReloaded();
30      }
31  }