In spring we use annotation based schedulers to configure the jobs.There are several ways to configure the jobs and among the good option is using cron expression. While configuring cron it expects constant values to be applied not a variable one in cron expression.
Only way to get dynamic cron expression is using property files as like below.Considering the fact property file is already configured in your spring container
Only way to get dynamic cron expression is using property files as like below.Considering the fact property file is already configured in your spring container
@Scheduled(cron = "${app.cron.expression}") public void myMethod() { }
0 Comments
Post a Comment