我的问题是计划方法“ updateMembers”被调用了两次。
我现在用谷歌搜索了几个小时,发现的问题可能是类Scheduler初始化了两次,但我不知道如何解决。
有什么建议么?

@Configuration
@EnableScheduling
public class Scheduler {

@Autowired
PersistenceService persistenceService;

@Scheduled(cron = "* */15 * * * *")
public void updateMembers(){
    try {
        persistenceService.updateMembers();
    }catch (IOException e){
        Logger.getLogger(Application.class.getName())
                .error("Scheduled updating of guildmembers failed due to: " + e.getMessage());
    }
}


也许问题出在别的地方?
在我的本地计算机上,没有发生此行为。在我的网络服务器上,约47秒后触发了第二个呼叫。工作大约需要2分钟

最佳答案

使用另一个Cron字符串解决了问题:cron =“ 0 * / 15 * * * *”

08-03 13:31