Provide time zone to Spring @Scheduled?

后端 未结 5 1607
广开言路
广开言路 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:32

    I doubt you want different jobs or parts of application to use different time zones. Assuming you want to have it all consistent and DRY, either configure OS on all servers to have consistent time zone, or set user.timezone Java system property for all of the application servers. Centrally manage configuration (OS, application server), and for that puppet and chef can be very useful.

提交回复
热议问题