Using Hibernate session with quartz

前端 未结 4 1667
北恋
北恋 2021-01-05 03:13

I\'ve a web application which uses framework like Struts and Hibernate. Currently I\'m developing a scheduler for this application using Quartz. While coding I realized that

4条回答
  •  别那么骄傲
    2021-01-05 03:44

    I know this is an old question, but I did a quick Google search, and this was the first hit.

    In the quartz job, add this line at the start of the method:

    public void execute(JobExecutionContext context) throws JobExecutionException
    {
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); //<-- this line
    
         //...your code here...
    }
    

    I apologize if this doesn't fix your specific issue, but I suspect it will catch someone in the future.

提交回复
热议问题