Want to call a bean method automatically when server starts
posted 3 years ago
It depends on the deployment environment. For instance, if you have a complete JEE 5 or 6 profile available it would be more appropriate to utilize the timer service. However in a simple servlet container like Tomcat there is no such facility, and you could solve it the way you described, or you could use a job scheduler like Quartz, although in your case that seems like overkill.