如何在 Spring 3 中配置自定义触发器? [英] How do I configure a custom trigger in Spring 3?
问题描述
我需要配置一个超出 Spring 内置调度能力的调度算法(基本上每 5 分钟一次,但仅在 4:00 和 16:00 之间").似乎实现 org.springframework.scheduling.Trigger 接口是要走的路,这似乎很简单.
I need to configure a scheduling algorithm that is beyond the capabilities of Spring's in-build scheduling (basically "every 5 minutes, but only between 4:00h and 16:00h"). It seems that implementing the org.springframework.scheduling.Trigger interface is the way to go, which seems simple enough.
我无法弄清楚的部分似乎没有在 文档 是:这如何与 XML 配置混合?似乎没有任何方法可以在任务命名空间的元素中指定自定义触发器 bean(除了 Quartz 示例).
The part I can't figure out and that doesn't seem to be answered in the documentation is: how does this mix with the XML configuration? There doesn't seem to be any way of specifying a custom trigger bean in the elements of the task namespace (apart from the Quartz example).
如何在 Spring 3 应用程序中使用自定义触发器?理想情况下使用 Bean XML 配置.
How do I use a custom trigger in a Spring 3 application? Ideally using the Bean XML configuration.
推荐答案
在 Spring 3.0 中,似乎无法使用 XML 配置除两个标准触发器之外的任何触发器.不过,它已作为新功能添加到 3.1M2 版本中:https://jira.springsource.org/browse/SPR-8205
It seems using XML to configure any but the two standard triggers is not possible in Spring 3.0. It has been added as a new feature in the 3.1M2 release, though: https://jira.springsource.org/browse/SPR-8205
感谢 Mark Fisher 指出这一点.
Thanks to Mark Fisher for pointing this out.
这篇关于如何在 Spring 3 中配置自定义触发器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!