-
May 19th, 2010, 01:11 PM
#1
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
-
May 20th, 2010, 09:10 AM
#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.
-
May 20th, 2010, 10:44 PM
#3
Can somebody please throw some light?
Regards,
Shashi
-
May 21st, 2010, 07:19 AM
#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.
-
May 23rd, 2010, 11:08 PM
#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
-
May 23rd, 2010, 11:24 PM
#6
-
May 23rd, 2010, 11:27 PM
#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
-
May 23rd, 2010, 11:37 PM
#8
That is a good question - I don't know.
-
May 23rd, 2010, 11:42 PM
#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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules