14
votes

I tried to use cron expression from this site http://www.cronmaker.com/

@Scheduled(cron = "0 0/15 * 1/1 * ? *")
public void clearRps() {
            
}

But it throws: java.lang.IllegalStateException: Encountered invalid @Scheduled method 'clearRps': Cron expression must consist of 6 fields (found 7 in "0 0/15 * 1/1 * ? *")

1

1 Answers

43
votes

Just use the following cron:

@Scheduled(cron = "0 0/15 * * * *")

Spring cron expression syntax slightly differs from unix cron expression. One immediate difference - it supports 1 less field (6 rather than 7).