Announcement Announcement Module
No announcement yet.
Event for application initialization completion? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Event for application initialization completion?


    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 '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
    Look into Spring's event handling.


    • #3
      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