title: How should I use WebApplication with multiple folders?
body: <p>Our wicket application extends WebApplication. We want to be able to trap access to secured pages when the session has expired, by time out or log out. It generally works, bringing up the SessionExpiredPage.</p>
  
  <p><strong>WicketApplication.java:</strong></p>
  
  <pre><code>public class WicketApplication extends WebApplication
  {
      @Override
      public RuntimeConfigurationType getConfigurationType()
      {
          return RuntimeConfigurationType.DEPLOYMENT;
      }
      @Override
      public Class&lt;? extends WebPage&gt; getHomePage()
      {
          return HomePage.class;
      }
  
      @Override
      public Session newSession(Request request, Response response)
      {
          return new LMSSession(request);
      }
      @Override
      public void init()
      {
          super.init();
          getApplicationSettings().setPageExpiredErrorPage(SessionExpiredPage.class);
          getApplicationSettings().setAccessDeniedPage(SessionExpiredPage.class);
          getPageSettings().setRecreateBookmarkablePagesAfterExpiry(false);
  
          getComponentInstantiationListeners().add(new SpringComponentInjector(this));
       }
  }
  </code></pre>
  
  <p>We have several folders to contain pages for users with different roles. We have had to add a class in each folder to get the Spring injection to work. The WebApplication class and most of the same methods are overridden. This works but some pages do not get trapped when the session is expired. Is there a better way of connecting Spring in these folders?</p>
  
  <p><strong>ClientApplication.java:</strong></p>
  
  <pre><code>public class ClientApplication extends WebApplication
  {
      // Same methods
      @Override
      public void init()
      {
          super.init();
  
          getComponentInstantiationListeners().add(new SpringComponentInjector(this));
      }
  }
  </code></pre>