2016-11-23 20 views
0

我2個調度,一個是驅動的註釋和其他正常的春季調度與「任務」多於一個的TaskScheduler和/或ScheduledExecutorService的上下文中存在

但添加下面的代碼到我的項目上下文定義後,我「M變得異常:

java.lang.IllegalStateException:超過一個的TaskScheduler和/或 ScheduledExecutorService的上下文中存在。刪除所有,但一個 的豆;或者執行SchedulingConfigurer接口,並調用 ScheduledTaskRegistrar#setScheduler在 之內明確配置configureTasks()回調函數。發現以下豆:[myappScheduler, 的TaskScheduler]

<file:inbound-channel-adapter id="scanIn" directory="file:${uploadfilepath}" auto-startup="true" prevent-duplicates="true" filename-regex="^.*\.(csv|xml)$" > 
    <int:poller id="poller" fixed-delay="60000" /> 
</file:inbound-channel-adapter> 

<int:service-activator input-channel="scanIn" output-channel="scanOut" ref="scanHandler" /> 

<file:outbound-channel-adapter id="scanOut" directory="file:${inputfiles.archive.path}" delete-source-files="true"/> 

<bean id="scanHandler" class="com.rs.ibgt.pf.intg.VirusScanHandler" /> 

請提出任何解決方案..

回答

0

Spring集成會將其自身(taskScheduler)豆。您需要顯示剩餘的配置 - 看起來您正嘗試自動連線調度程序;如果需要,您需要添加@Qualifier或給它起一個名稱以匹配您實際嘗試注入的bean(例如myappScheduler)。

相關問題