Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个通用的工作类,它需要一些参数而不是事先创建工作类?
所有设置都存储在数据库中,因此我们可以调用“刷新”,它会删除所有作业并从数据库中重新注册它们。
您可以在 中为您的工作指定参数JobExecutionContext,例如由 spring 注入。
JobExecutionContext
“Spring Recipes”一书中有一个非常简单的示例来演示如何使用 Quartz。我建议看看。
您可以重用逻辑(作业)并使用 JobDataMap 对其进行参数化。您可以拥有任意数量的触发器和作业。只要记住一个工作可以有很多触发器但反之不行的规则。