我希望保持spring任务之间的值:scheduled,例如我的cron每小时触发一次。
<task:scheduled-tasks>
<task:scheduled ref="runScheduler" method="run" cron="0 0 * * * *" />
</task:scheduled-tasks>我想知道,如何从最后一个小时的cron线程获取下一个cron线程的值。
发布于 2016-10-01 14:46:50
Cron属性与@Scheduled注释一起使用。此属性的值必须是cron expression.This cron表达式将在属性文件中定义,相关属性的键将在@Scheduled注释中使用。
<task:scheduled-tasks>
<task:scheduled ref="runScheduler" method="run" cron="#{applicationProps['cron.expression']}" />
</task:scheduled-tasks>然后使用@Scheduled(cron = "${cron.expression}")注释。
下面的链接可能会对您有所帮助:
http://howtodoinjava.com/spring/spring-core/4-ways-to-schedule-tasks-in-spring-3-scheduled-example/
https://stackoverflow.com/questions/39803564
复制相似问题