|
From: Joris K. <jor...@gm...> - 2006-02-06 18:34:57
|
2006/2/6, Norm Deane <nor...@va...>: > > I've been wanting to dependency-inject my Quartz jobs for a while now. It > looks > like with the new JobFactory in Quartz 1.5 we could pull this off by > creating a > simple implementation (SpringBeanNameJobFactory?) that pulls Jobs from th= e > ApplicationContext by bean name. > > Thoughts? If this sounds reasonable I'll create an issue in Jira and time > permitting upload a patch. You can also subclass Spring's QuartzJobBean and let your dependencies be injected from Quartz's SchedulerContext or JobDataMap (the one merged with the Trigger's, in Spring 2.0-M2). Not the same thing, but it achieves the same goal and works out of the box today. If your jobs are persisted, make sure you don't put the ApplicationContext (directly or indirectly) in the Job's JobDetailMap, but use the SchedulerContext for that. See http://static.springframework.org/spring/docs/2.0-m2/api/org/springframewor= k/scheduling/quartz/QuartzJobBean.htmlfor more info. Joris |