Class CdiAwareJobFactory

  • All Implemented Interfaces:
    org.quartz.spi.JobFactory

    public class CdiAwareJobFactory
    extends Object
    implements org.quartz.spi.JobFactory
    A custom implementation of the Quartz `JobFactory` that integrates with CDI (Contexts and Dependency Injection). This factory creates job instances, either directly or as CDI-managed beans, depending on the job class annotations.
    • Constructor Detail

      • CdiAwareJobFactory

        public CdiAwareJobFactory()
    • Method Detail

      • newJob

        public org.quartz.Job newJob​(org.quartz.spi.TriggerFiredBundle bundle,
                                     org.quartz.Scheduler scheduler)
                              throws org.quartz.SchedulerException
        Creates a new job instance. If the job class is a CDI bean, it is instantiated using the CDI container. Otherwise, the job instance is created directly using reflection.
        Specified by:
        newJob in interface org.quartz.spi.JobFactory
        Parameters:
        bundle - The `TriggerFiredBundle` containing the job details.
        scheduler - The Quartz `Scheduler` instance.
        Returns:
        The created job instance.
        Throws:
        org.quartz.SchedulerException - If the job instance cannot be created.