Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Spring context initialized event? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring context initialized event?

    Hi,

    I would like to know if there is a way I can get an event if spring context is initialized without any errors. I want to start configuring other components after this is done. Currently I have used ApplicationContextAware class to get a callback to set application context.

    However this would get called even if there any services in the OSGi registry which remain unresolved. This would be a false event then.

    Please throw some pointers.

    Regards,
    Shashi

  • #2
    same question

    I have the same question. I want to get called back after all beans have been instantiated and their init-methods have been called and after all bean post-processors have been run.

    Comment


    • #3
      Can somebody please throw some light?

      Regards,
      Shashi

      Comment


      • #4
        implement ApplicationListener<ContextRefreshedEvent>

        I tried implementing ApplicationListener<ContextRefreshedEvent> and onApplicationEvent gets called before I get the message

        INFO - org.springframework.web.context.ContextLoader.init WebApplicationContext:214 | Root WebApplicationContext: initialization completed in 12429 ms

        so that seems to be a good bet.

        Comment


        • #5
          Thanks,

          Was that in a web application or Spring DM? I am not sure if the similar event is raised in DM environment.

          Regards,
          Shashi

          Comment


          • #6
            in a web app
            -- Eric

            Comment


            • #7
              Hi,

              Context may be refreshed multiple times (e.g. by bean post processors) and doesn't guarantee that it's initialized completely once this event is raised.

              Is there any guaranteed way to ensure that context has been initialized completely?

              Regards,
              Shashi

              Comment


              • #8
                That is a good question - I don't know.

                Comment


                • #9
                  Hi,

                  I just noticed I had already implemented ApplicationListener where I was listening to ContextRefreshedEven, however I remember this was getting called multiple times since I had multiple PPs defined in my context.

                  Thanks,
                  Shashi

                  Comment

                  Working...
                  X