Java Spring @Scheduled tasks executing twice

前端 未结 23 1691
清歌不尽
清歌不尽 2020-11-29 09:07

I have a simple test method here that is set to run every 5 seconds and it does, but looking at the System.out you can see it appears to be doing something odd.



        
23条回答
  •  情书的邮戳
    2020-11-29 09:38

    I had the same problem. Spent hours trying to resolve.

    Solution was the application was deploying twice on Tomcat.

    When trying to clean Tomcat it gave an error.

    Checking the server.xml Tomcat file I noticed the same was being deployed twice. There was also an unclosed "host" tag. Not sure which of these fixed it but relieved to have it working properly again.

提交回复
热议问题