本文整理汇总了Java中org.springframework.scheduling.quartz.JobDetailFactoryBean.setApplicationContext方法的典型用法代码示例。如果您正苦于以下问题:Java JobDetailFactoryBean.setApplicationContext方法的具体用法?Java JobDetailFactoryBean.setApplicationContext怎么用?Java JobDetailFactoryBean.setApplicationContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.scheduling.quartz.JobDetailFactoryBean
的用法示例。
在下文中一共展示了JobDetailFactoryBean.setApplicationContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJob
import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入方法依赖的package包/类
/**
* Create Quartz Job.
*
* @param jobClass Class whose executeInternal() method needs to be called.
* @param isDurable Job needs to be persisted even after completion. if true, job will be persisted, not otherwise.
* @param context Spring application context.
* @param jobName Job name.
* @param jobGroup Job group.
*
* @return JobDetail object
*/
protected static JobDetail createJob(Class<? extends QuartzJobBean> jobClass, boolean isDurable,
ApplicationContext context, String jobName, String jobGroup){
JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
factoryBean.setJobClass(jobClass);
factoryBean.setDurability(isDurable);
factoryBean.setApplicationContext(context);
factoryBean.setName(jobName);
factoryBean.setGroup(jobGroup);
// set job data map
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put("myKey", "myValue");
factoryBean.setJobDataMap(jobDataMap);
factoryBean.afterPropertiesSet();
return factoryBean.getObject();
}
示例2: createJobDetail
import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入方法依赖的package包/类
private JobDetailFactoryBean createJobDetail(String name, Class<?> jobClass) {
JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
factoryBean.setName(name);
factoryBean.setJobClass(jobClass);
factoryBean.setApplicationContext(context);
factoryBean.setApplicationContextJobDataKey(AbstractJob.KEY_APPLICATION_CONTEXT);
// job has to be durable to be stored in DB:
factoryBean.setDurability(true);
factoryBean.afterPropertiesSet();
return factoryBean;
}
示例3: createJobDetail
import org.springframework.scheduling.quartz.JobDetailFactoryBean; //导入方法依赖的package包/类
private JobDetail createJobDetail(final PiSchedule piSchedule) {
final JobDetailFactoryBean jobDetailFactoryBean = new JobDetailFactoryBean();
jobDetailFactoryBean.setApplicationContext(context);
jobDetailFactoryBean.setName(piSchedule.getScheduleName());
jobDetailFactoryBean.setJobClass(PiJob.class);
jobDetailFactoryBean.getJobDataMap().put("piSchedule", piSchedule);
jobDetailFactoryBean.afterPropertiesSet();
return jobDetailFactoryBean.getObject();
}