How to load a cron expression from db and reschedule it with Spring?

自作多情 提交于 2019-12-06 20:01:34

问题


I'm using Spring scheduling to have batches in my application.

@Scheduled(cron = "${batch.name|0 0 21 * * ?}")
public void restart() { }

Values are load from a properties file and default value from the @Scheduled annotation parameter.

Now, I would like to be able to load a cron value from database (so from an object) without using Quartz library, only with the default Spring scheduler.

Does someone know if and how it is possible?

Thank you in advance.


回答1:


I found a solution by following this : Spring @Scheduled annotation

and this : http://tutorials.jenkov.com/java-util-concurrent/scheduledexecutorservice.html



来源:https://stackoverflow.com/questions/32066501/how-to-load-a-cron-expression-from-db-and-reschedule-it-with-spring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!