Dynamic cron expression in scheduled annotation

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

@Scheduled(cron = "${app.cron.expression}")
public void myMethod() {


Post a Comment

Powered by Blogger.