首页>代码>spring boot+spring data jpa+h2实现quartz任务管理系统>/spring-boot-quartz-master/src/main/java/com/stackabuse/config/SchedulerJobFactory.java
package com.stackabuse.config;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
public class SchedulerJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {
private AutowireCapableBeanFactory beanFactory;
@Override
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
}
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
final Object job = super.createJobInstance(bundle);
beanFactory.autowireBean(job);
return job;
}
}
最近下载更多
最近浏览更多
微信网友_7525238679375872 LV1
5月25日
yimaoermao LV1
2024年11月28日
TY0165 LV20
2024年6月17日
Gin19960217 LV4
2024年4月15日
zjjhzjb LV15
2024年3月20日
woldxy LV12
2024年2月19日
百里守寡 LV5
2024年2月5日
WBelong LV8
2023年12月27日
yuning1993 LV6
2023年9月19日
zh11332 LV11
2023年9月12日

