Results 1 to 3 of 3

Thread: Event for application initialization completion?

  1. #1

    Default Event for application initialization completion?

    Hi!

    I'm using Spring 3.0.2.

    I have few threads that cannot start doing their thing until the application is officially up and running. I would like to find a way to notify a bean that the context finished initializing all the other beans and that the application is now officially available.

    (so right after this line):

    2011-02-14 10:56:06,180 INFO [main] org.springframework.web.servlet.FrameworkServlet (FrameworkServlet.java:320) - FrameworkServlet 'xxxxxxxxx': initialization completed in 722 ms

    I found a way to get a hold of the enclosing ApplicationContext by implementing ApplicationContextAware and supplying:

    public void setApplicationContext(ApplicationContext applicationContext) ...

    That's great .. but I don't know how to find out if the context is finished initializing? The API does not have anything useful for that purpose.

    Thanks for your help!

  2. #2
    Join Date
    Jul 2010
    Posts
    139

    Default

    Look into Spring's event handling.

  3. #3

    Default

    Great, thanks, I managed to do what I needed by implementing ApplicationListener<ContextRefreshedEvent>.

    Now I just have to make sure I catch the right one for my app

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •