Provide time zone to Spring @Scheduled?

后端 未结 5 1605
广开言路
广开言路 2020-12-16 09:09

How can I configure the time zone for a Spring based @Scheduled cron job?

Background:

I have a job that executes once a day, say 2 PM, usin

5条回答
  •  感情败类
    2020-12-16 09:36

    You can also use time zone with @Scheduled tag in spring-boot like this :

    @Scheduled(cron = "0 0 14 * * *" , zone = "GMT+5:00")
    public void execute() {
        // do the scheduled job
    }
    

提交回复
热议问题