title: JSF initialize application-scope bean when context initialized
body: <p>I'm building a JSF+Facelets web app, one piece of which is a method that scans a directory every so often and indexes any changes.  This method is part of a bean which is in application scope.  I have built a subclass of TimerTask to call the method every X milliseconds.  My problem is getting the bean initialized.  I can reference the bean on a page, and when I go to the page, the bean is initialized, and works as directed; what I would like instead is for the bean to be initialized when the web context is initialized, so that it doesn't require a page visit to start the indexing method.  Google has shown a few people that want this functionality, but no real solutions outside of integrating with Spring, which I really don't want to do just to get this piece of functionality.</p>
  
  <p>I've tried playing around with both the servlets that have "load-on-startup" set, and a ServletContextListener to get things going, and haven't been able to get the set up right, either because there isn't a FacesContext available, or because I can't reference the bean from the JSF environment.</p>
  
  <p>Is there any way to get a JSF bean initialized on web app startup?</p>