Java Spring @Scheduled tasks executing twice

前端 未结 23 1657
清歌不尽
清歌不尽 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:40

    I encountered similar problem. It could be because of below reasons.

    1. A bug in spring versions https://jira.spring.io/browse/SPR-10830

    2. Context being loaded twice.

    3. The log4j.xml writing the logs twice. It happened in my case not sure about yours. If you have tried the other options, try this one also.

提交回复
热议问题