PackageCom.pkfare.task.manage.config;ImportOrg.quartz.spi.TriggerFiredBundle;Importorg.springframework.beans.BeansException;ImportOrg.springframework.context.ApplicationContext;ImportOrg.springframework.context.ApplicationContextAware;Importorg.springframework.context.annotation.Configuration;Importorg.springframework.scheduling.quartz.SpringBeanJobFactory;Importorg.springframework.stereotype.Component, @Configuration @component Public classJobbeanjobfactoryextendsSpringbeanjobfactoryImplementsApplicationcontextaware {PrivateApplicationContext ApplicationContext; Public voidSetapplicationcontext (ApplicationContext ApplicationContext)throwsbeansexception { This. ApplicationContext =ApplicationContext; } @OverrideprotectedObject createjobinstance (Triggerfiredbundle bundle)throwsException {Object jobinstance=Super. Createjobinstance (bundle); //Give the job to spring to manage so that the job can use the bean generated by spring .applicationcontext.getautowirecapablebeanfactory (). Autowirebean (jobinstance); returnjobinstance; }}
Cron Spring Boot