Spring配置自动加载执行多次的解决方法

首先我的情况网上的方法都没用,这个是反复加载Service的问题,具体不说了

解决方法如下:

单独弄一个配置文件,需要自动加载的全部放里面去。不要忘了改web.xml让它扫描

配置文档里面一共三种方法,用自定义那个,如下

<task:scheduled-tasks>
<task:scheduled ref="TestService" method="Test"
cron="00 00,10,20,30,40,50 * * * *" />
</task:scheduled-tasks>

cron里面按倒序是年月日时分秒

以上

原文地址:https://www.cnblogs.com/IceBlueBrother/p/8421792.html