【Spring Boot採坑記】- 定時任務之 @Scheduled

Spring 定時任務 @Scheduled

@Scheduled(cron = "${timer.test-sync-time-task}")

1.錯誤示範

timer:
  test-sync-time-task: 0 /1 * * * ?

報錯:

nested exception is java.lang.IllegalStateException: Encountered invalid @Scheduled method ‘timeTask’: For input string: “”

2.正確書寫

timer:
  test-sync-time-task: 0 0/1 * * * ?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章