我在Spring的任务调度程序中安排了几个任务:
<task:scheduled-tasks>
<task:scheduled ref="task1" method="run"
cron="0 0 */0 * * *" />
<task:scheduled ref="task2" method="run"
cron="0 0 */30 * * *" />
</task:scheduled-tasks>
<task:scheduler id="scheduler" pool-size="10" />
Run Code Online (Sandbox Code Playgroud)
如何从应用程序上下文中访问计划任务列表并检索元信息(例如下一个执行时间)?
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler)context.getBean("scheduler");
//... how to continue from here?
Run Code Online (Sandbox Code Playgroud)