I am looking into implementing some custom functionality involving the addition of jobs to the scheduler (quartz). In the scheduled-jobs-context.xml file there is a bean - "schedulerFactory" as shown below
I was just wondering whether anyone knows how or whether I can get access to this bean so I can add more triggers to it on demand (through a web interface).
I am familiar with adding jobs through the config, but in particular case I will be doing it through code. Out of interest, are there any development resources on how to get the relevant beans in code (I couldn't find anything in the wiki so far). I am unsure of the application context or the specific classes to use to do a getBean() call.
You need to define a bean into which you would then inject the scheduler. You can then use the scheduler bean to schedule jobs. (You will get an org.quartz.Scheduler as this may not be clear)
You can use another Scheduler (identified by name, rather than the default) by defining another SchedulerFactoryBean. See the documentation for SchedulerFactoryBean.
You can get hold of other beans by name if your bean implements the BeanFactoryAware interface. Then you get access to the BeanFactory. Most beans are configured by injection rather than looking up beans this way. See the interfaces in the Spring org.springframework.beans.factory package for more details.