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

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

    Comment


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

      Comment

      Working...
      X