且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么不是Spring运行我@Scheduled的方法?

更新时间:2023-01-23 18:07:58

所以...它看起来像有春天3.0.x的一个问题(至少是3.0.4和3.0.5)具有发现做在AOP代理 @Scheduled 注释。我有一个切入点声明包裹 @Scheduled 法事务的意见,这似乎是问题的根源。如果我删除的意见,作业运行。如果我早在添加它,春没有找到和我的批注的方法创建一个任务。

So...it looks like there's a problem in Spring 3.0.x (at the very least 3.0.4 and 3.0.5) having to do with discovering @Scheduled annotations on AOP proxies. I've got a pointcut declaration wrapping the @Scheduled method with transactional advice, and that seems to be the root of the problem. If I remove the advice, the job runs. If I add it back in, Spring fails to find and create a task for my annotated method.

所以,我要去一个bug与Spring乡亲,并在此期间我坚持手工宣布我的任务。

So, I'm going to go file a bug with the Spring folks, and in the meantime I'm stuck declaring my tasks manually.