How to cancel Spring timer execution

后端 未结 3 704
生来不讨喜
生来不讨喜 2021-01-02 06:26

I need to cancel Spring timer execution or at least change the execution frequency based on some conditions. Was using both org.springframework.scheduling.quartz.Simpl

3条回答
  •  独厮守ぢ
    2021-01-02 06:27

    The solution is to assign an id to the org.springframework.scheduling.timer.TimerFactoryBean and then retrieve this bean from the application, cast it to Timer and call cancel method on that object.

提交回复
热议问题