Why isn't Spring running my @Scheduled method?

前端 未结 8 1676
天涯浪人
天涯浪人 2020-12-29 03:18

I\'m a bit befuddled because I\'m trying use use @Scheduled annotations, but Spring doesn\'t seem to be finding my methods. The end result is that, none of my m

8条回答
  •  滥情空心
    2020-12-29 03:59

    add "task:annotation-driven" ?

     
    
      
      
      
      
      
    
    
    

    reference http://howtodoinjava.com/2013/04/23/4-ways-to-schedule-tasks-in-spring-3-scheduled-example/

    or

    Spring @Configuration (non-xml configuration) for annotation-driven tasks

    Just add @EnableScheduling on you WebMvcConfig class

    @Configuration
    @EnableWebMvc
    @EnableAsync
    @EnableScheduling
    public class WebMvcConfig extends WebMvcConfigurerAdapter {
       /** Annotations config Stuff ... **/
    }
    

    reference Spring Scheduler does not work

提交回复
热议问题