Java Code Examples for org.springframework.scheduling.quartz.SchedulerFactoryBean#setConfigLocation()

The following examples show how to use org.springframework.scheduling.quartz.SchedulerFactoryBean#setConfigLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringQrtzScheduler.java    From tutorials with MIT License 6 votes vote down vote up
@Bean
public SchedulerFactoryBean scheduler(Trigger trigger, JobDetail job, DataSource quartzDataSource) {

    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);

    // Comment the following line to use the default Quartz job store.
    schedulerFactory.setDataSource(quartzDataSource);

    return schedulerFactory;
}
 
Example 2
Source File: XxlJobDynamicSchedulerConfig.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public SchedulerFactoryBean getSchedulerFactoryBean(DataSource dataSource){

    SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
    schedulerFactory.setDataSource(dataSource);
    schedulerFactory.setAutoStartup(true);                  // 自动启动
    schedulerFactory.setStartupDelay(20);                   // 延时启动,应用启动成功后在启动
    schedulerFactory.setOverwriteExistingJobs(true);        // 覆盖DB中JOB:true、以数据库中已经存在的为准:false
    schedulerFactory.setApplicationContextSchedulerContextKey("applicationContext");
    schedulerFactory.setConfigLocation(new ClassPathResource("quartz.properties"));

    return schedulerFactory;
}
 
Example 3
Source File: XxlJobDynamicSchedulerConfig.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
@Bean
public SchedulerFactoryBean getSchedulerFactoryBean(DataSource dataSource) {

    SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
    schedulerFactory.setDataSource(dataSource);
    schedulerFactory.setAutoStartup(true);                  // 自动启动
    schedulerFactory.setStartupDelay(20);                   // 延时启动,应用启动成功后在启动
    schedulerFactory.setOverwriteExistingJobs(true);        // 覆盖DB中JOB:true、以数据库中已经存在的为准:false
    schedulerFactory.setApplicationContextSchedulerContextKey("applicationContext");
    schedulerFactory.setConfigLocation(new ClassPathResource("quartz.properties"));

    return schedulerFactory;
}
 
Example 4
Source File: SchedulerConfig.java    From SpringBoot2.0 with Apache License 2.0 5 votes vote down vote up
@Bean(name = "SchedulerFactory")
public SchedulerFactoryBean schedulerFactoryBean() {
    SchedulerFactoryBean bean = new SchedulerFactoryBean();
    bean.setDataSource(dataSource);
    bean.setStartupDelay(5);
    bean.setAutoStartup(true);
    bean.setApplicationContextSchedulerContextKey("applicationContext");
    bean.setConfigLocation(new ClassPathResource("/quartz.properties"));
    return bean;
}
 
Example 5
Source File: XxlJobDynamicSchedulerConfig.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
@Bean
public SchedulerFactoryBean getSchedulerFactoryBean(DataSource dataSource) {

    SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
    schedulerFactory.setDataSource(dataSource);
    schedulerFactory.setAutoStartup(true);                  // 自动启动
    schedulerFactory.setStartupDelay(20);                   // 延时启动,应用启动成功后在启动
    schedulerFactory.setOverwriteExistingJobs(true);        // 覆盖DB中JOB:true、以数据库中已经存在的为准:false
    schedulerFactory.setApplicationContextSchedulerContextKey("applicationContext");
    schedulerFactory.setConfigLocation(new ClassPathResource("quartz.properties"));

    return schedulerFactory;
}