I am using the Spring Schedular in my Spring Boot Application. I have defined the cron expression a properties file:
batch.delete-job.cron=0 0 0 * * *
I am using this value in my method annoated with the @Scheduled Annotation as follows:
@Scheduled(cron = "${batch.delete-job.cron}")
public void doBatchJob() {
}
I keep on getting the error messsage:
Encountered invalid @Scheduled method 'doBatchJob': Cron expression must consist of 6 fields (found 1 in "${batch.delete-job.cron}")
If I use the cron expression directly in annotation, then it works. What am I doing wrong?