How do I automatically execute a method bean session when deploying ears?

I need the session bean method to execute periodically every week at a specific time. I am thinking of using a quartz scheduler for this. My question is, how do I get the scheduler to run from the moment the .ear file is deployed? Is there any annotation I can use in a stateless session bean that calls the scheduler.start method like @PostConstruct or something?

+2


source to share


1 answer


The problem with @PostConstruct for a stateless bean is that something has to initiate the construction of the bean.



There is no standard way to do what you are trying to do before EJB 3.1 (automatic timers or single-user session beans). Until then, you could use a dummy WAR with a ServletContextListener to set up your EJB timer.

+4


source







All Articles