All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.scheduler.SchedulerConfig Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.scheduler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/**
 * Configure a scheduler factory based on a Quartz scheduler with jobs supporting autowiring.
 */
@Configuration
public class SchedulerConfig
{
	@Autowired
	private ApplicationContext applicationContext;

	@Bean
	public SchedulerFactoryBean schedulerFactoryBean()
	{
		SchedulerFactoryBean quartzScheduler = new SchedulerFactoryBean();
		AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
		jobFactory.setApplicationContext(applicationContext);
		quartzScheduler.setJobFactory(jobFactory);
		return quartzScheduler;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy