Why isn't Spring running my @Scheduled method?

前端 未结 8 1663
天涯浪人
天涯浪人 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:58

    The only difference that I see from my setup (which works), is that my class is annotated with @Component rather than @Service. Other things to check:

    • whether you have the proper jars on the classpath (spring-context, I think)
    • put a breakpoint and check whether it really isn't executing
    • double-check the cron expression (I admit I always consult the docs for that). Or use a fixed delay, just to check if it works
    • try upgrading to 3.0.5 or the latest 3.1 snapshot.

提交回复
热议问题