package com.blueland.config.quartz.util;

import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.scheduling.quartz.AdaptableJobFactory;

/**
* @author zhengTao
* @version 创建时间：2019年4月26日 下午9:05:38
   * 动态注入bean
*/
public class ScheduleJobFactory extends AdaptableJobFactory{
	 @Autowired
	 private AutowireCapableBeanFactory capableBeanFactory;
 
	 @Override
	 protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
        Object jobInstance = super.createJobInstance(bundle);
        capableBeanFactory.autowireBean(jobInstance);
        return jobInstance;
	 }

}
