-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quartz Scheduler - configurable SchedulerFactory [SPR-16439] #20985
Comments
Juergen Hoeller commented Considering the That said, what we can certainly do is to open it up for overriding. We could either provide a protected |
Juergen Hoeller commented I went with a |
Andrej Urvantsev commented I think And, yes, if provided factory does not extend if (this.configLocation != null || this.quartzProperties != null ||
this.taskExecutor != null || this.dataSource != null) {
throw new IllegalArgumentException(
"StdSchedulerFactory required for applying Quartz properties: " + schedulerFactory);
} from Or maybe factories which are set through |
Andrej Urvantsev commented Could you also back-port it to 4.3 branch? |
Juergen Hoeller commented We can't apply those properties to arbitrary The 4.3.x branch is generally in maintenance mode already. However, this one is easy enough to backport: I'll do so later this week (along with a few other recent fixes) so that it'll appear in |
Andrej Urvantsev commented Created #20986 about initialization. |
Juergen Hoeller commented I've relaxed the local properties check to only apply to |
Andrej Urvantsev commented Sorry for being annoying and thank you for your patience :) It looks a way better now - just a thought: when you provide TL;DR: I would use initSchedulerFactory only when |
Juergen Hoeller commented Indeed, since we're free to define the semantics for an externally provided |
Andrej Urvantsev opened SPR-16439 and commented
I was trying to integrate quartz-mongodb with Spring, but found that it's nearly impossible to do that without ugly hacks.
What I wanted is to provide a bean that implements org.quartz.SchedulerFactory which injects MongoClient, so I can create a scheduler which can store jobs in MongoDB.
The problem is in the implementation of
org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet
:Here it instantiates a factory using reflection(I think). Instead I would like to have conditional scheduler factory initialization - if there is a bean of org.quartz.SchedulerFactory, then use it, otherwise use the code above.
Or even better: StdSchedulerFactory can be created as conditional bean as well - if there is not any SchedulerFactory, then create default one.
In the worst case the code above can be moved to protected method so it's possible to override it.
Affects: 4.3.14, 5.0.3
Issue Links:
Referenced from: commits cd57335, 857a5b0, 33d655a, c7f60d1
Backported to: 4.3.15
The text was updated successfully, but these errors were encountered: