2013-01-17 31 views
0

我使用彈簧集成-JDBC數據庫監聽一個SqlParameterSource刷新數據

將查詢對數據庫永遠,配置如下圖所示

<int-jdbc:inbound-channel-adapter id="listener" 
    channel="target" 
    data-source="dataSource" 
    query="select * from view1 where type='ABCD' and date=:newDate" 
    selec-sql-paramater-source="parameterList" 
    auto-startup="true"> 

     <integration:poller> 
      <integration:interval-trigger interval="100000"/> 
     </integration:poller> 

    </int-jdbc:inbound-channel-adapter> 

<integration:splitter input-channel="chone" output-channel="chtwo"/> 
<integration:service-activator input-channel="chone" ref="myclass" method="mymethod"/> 

<integration:channel id="chone"/> 
<integration:channel id="chtwo"/> 

<bean id="parameterList" class="com.my.package.mySqlParamenterSource"> 
<property name="newDate" value="${date}"/> 
</bean> 

我要在查詢newDate參數被刷新每天自動..沒有重新啓動應用程序..如何做到這一點?

回答

1

鑑於您已經擁有自定義參數源,每當調用getValue(「newDate」)時,只需讓它返回適當的日期即可。

或者,您可以通過使用運行時SpEL表達式來獲得更復雜的結果。