Java Spring @Scheduled tasks executing twice

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

    
        contextConfigLocation
        
             /WEB-INF/spring/root-context.xml
             /WEB-INF/spring/security/spring-security.xml
             /WEB-INF/spring/mongo/mongo-config.xml
             /WEB-INF/spring/appServlet/spring-context.xml
        
    
    
        appServlet
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            /WEB-INF/spring/appServlet/spring-context.xml
        
        1
    
    

    That is my web.xml . So , you can see that "/WEB-INF/spring/appServlet/spring-context.xml" is loaded twice (once in context-param , once in servlet -> init-param ).

提交回复
热议问题