package com.zl.yxt.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.SpringBeanJobFactory; import org.springframework.stereotype.Component; @Component //解决job(quzrtz)不可调用spring的bean public class JobFactory extends SpringBeanJobFactory { @Autowired private AutowireCapableBeanFactory beanFactory; /** * 这里覆盖了super的createJobInstance方法,对其创建出来的类再进行autowire。 * * @param bundle * @return * @throws Exception */ @Override protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { Object jobInstance = super.createJobInstance(bundle); beanFactory.autowireBean(jobInstance); return jobInstance; } }

zolscy LV24
2024年11月27日
微信网友_6927932988952576 LV12
2024年3月31日
顾北城 LV12
2024年3月28日
西瓜哥哥 LV4
2023年8月8日
ericxu1116 LV24
2023年5月28日
1806795436 LV4
2023年1月10日
331376387 LV5
2022年11月16日
qlpqlp LV7
2022年11月14日
郎建伟 LV1
2022年11月11日
wensente LV2
2022年11月2日

calm_z LV2
3月23日
Daima000 LV4
2024年12月3日
微信网友_7005050423463936
2024年12月2日
暂无贡献等级
zolscy LV24
2024年11月27日
yangchengshuai LV15
2024年10月29日
huangzy LV12
2024年10月23日
withyouatdusk LV2
2024年10月19日
sgm123456 LV13
2024年10月12日
talete LV3
2024年9月29日
Lxmzdm123 LV3
2024年9月20日