32 lines
940 B
Java
32 lines
940 B
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.ifish.socket.config;
|
|
|
|
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 Administrator
|
|
*/
|
|
public class JobFactory extends AdaptableJobFactory {
|
|
|
|
@Autowired
|
|
private AutowireCapableBeanFactory capableBeanFactory;
|
|
|
|
@Override
|
|
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
|
|
//调用父类的方法
|
|
Object jobInstance = super.createJobInstance(bundle);
|
|
//进行注入
|
|
capableBeanFactory.autowireBean(jobInstance);
|
|
return jobInstance;
|
|
}
|
|
|
|
}
|