-
Jun 22nd, 2006, 12:28 PM
#1
Post Deployment Method Call
Hello,
I need to call a method on a bean after the application is fully deployed. How do I do that?
Thanks
Tom
-
Jun 22nd, 2006, 01:36 PM
#2
You can create an object which implements ApplicationListener and deploy it in your application context. It will get invoked whenever an ApplicationContext event occurs. One of those events is when the ApplicationContext is either initialized or refreshed.
Bill
-
Jun 22nd, 2006, 02:29 PM
#3
or you can use a scheduler to run a method in 1 min after start.
silly, but works
-
Jun 22nd, 2006, 02:35 PM
#4
Unless you are on a server which takes more than a minute to startup. Or the startup is so quick, you'd rather want your method called ASAP rather than waiting a minute.
Bill
-
Jun 22nd, 2006, 03:58 PM
#5
sure.
anyway, in some cases it might be the best solution. The main (and only) advantage of this approach, is that you don't introduce any dependency on Spring's life-cycle
-
Jun 23rd, 2006, 08:17 AM
#6
Hello,
Thanks for the suggestions. I tried implementing the ApplicationListener and catching the ContextRefreshedEvent but that happens before the deployment is complete.
Thanks
Tom
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