use of org.springframework.scheduling.quartz.SchedulerFactoryBean in project spring-cloud-framework by zhuwj921.
the class SchedulerConfiguration method schedulerFactoryBean.
@Bean(name = "SchedulerFactory")
public SchedulerFactoryBean schedulerFactoryBean() throws IOException {
// 获取配置属性
PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties"));
// 在quartz.properties中的属性被读取并注入后再初始化对象
propertiesFactoryBean.afterPropertiesSet();
// 创建SchedulerFactoryBean
SchedulerFactoryBean factory = new SchedulerFactoryBean();
factory.setQuartzProperties(propertiesFactoryBean.getObject());
// 使用数据源
factory.setDataSource(dataSource);
factory.setJobFactory(jobFactory);
return factory;
}
use of org.springframework.scheduling.quartz.SchedulerFactoryBean in project tutorials by eugenp.
the class SpringQrtzScheduler method scheduler.
@Bean
public SchedulerFactoryBean scheduler(Trigger trigger, JobDetail job) {
SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
schedulerFactory.setConfigLocation(new ClassPathResource("quartz.properties"));
logger.debug("Setting the Scheduler up");
schedulerFactory.setJobFactory(springBeanJobFactory());
schedulerFactory.setJobDetails(job);
schedulerFactory.setTriggers(trigger);
return schedulerFactory;
}
use of org.springframework.scheduling.quartz.SchedulerFactoryBean in project openmeetings by apache.
the class Admin method getApplicationContext.
private WebApplicationContext getApplicationContext() {
if (context == null) {
// preserve step
String _step = step;
step = "Shutdown schedulers";
Long lngId = (long) cfg.getDefaultLangId();
context = ApplicationHelper.getApplicationContext(lngId);
SchedulerFactoryBean sfb = context.getBean(SchedulerFactoryBean.class);
try {
sfb.getScheduler().shutdown(false);
// restore
step = _step;
} catch (Exception e) {
handleError(e);
}
}
return context;
}
use of org.springframework.scheduling.quartz.SchedulerFactoryBean in project erp-catering by liuyandong33.
the class QuartzSchedulerConfiguration method schedulerFactoryBean.
@Bean
public SchedulerFactoryBean schedulerFactoryBean(JobFactory jobFactory) {
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
schedulerFactoryBean.setJobFactory(jobFactory);
return schedulerFactoryBean;
}
use of org.springframework.scheduling.quartz.SchedulerFactoryBean in project cloudbreak by hortonworks.
the class AppConfig method schedulerFactoryBean.
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
scheduler.setTaskExecutor(getAsyncExecutor());
scheduler.setAutoStartup(true);
scheduler.setJobFactory(new SimpleJobFactory());
return scheduler;
}
Aggregations