spring 定時器 @Component 執行兩次 問題解決

我的問題原因 是 因爲我的定時器配置在SpringMVC的配置文件applicationContext.xml中,而web.xml中ContextLoaderListener 和 DispatcherServlet都會掃描這個文件。故而項目啓動時定時器會執行兩次。 所以 只需要將 定時器配置單獨 配成一個文件 applicationContext-task.xml, 在ContextLoaderL
相關文章
相關標籤/搜索