2016-09-26 73 views
0

感謝您的關注
我在我的項目中使用Spring Integration,我想從數據庫中讀取配置,如自動啓動,遠程目錄等,它是怎麼做到的?
我的代碼如下:如何在spring集成中從數據庫讀取配置適配器?

<int-ftp:inbound-channel-adapter id="my-inbound-channel-adapter" 
            channel="ready-to-process-inbound-tmp-mover" 
            session-factory="ftp-Session" 
            auto-create-local-directory="..... read from db......" 
            delete-remote-files="..... read from db......" 
            auto-startup="..... read from db......" 
            filename-regex="..... read from db......" 
            remote-directory="..... read from db......" 
            remote-file-separator="/" 
            local-filename-generator-expression="...stuff code..." 
            temporary-file-suffix=".writing" 
            local-directory="..... read from db......"> 
     <int:poller fixed-rate="..... read from db......" error-channel="errorChannel"/> 
    </int-ftp:inbound-channel-adapter> 

回答

1

使用SpEL調用方法在一個bean - #{myConfigBean.autoStartupSetting}將調用getAutoStartupSetting()

或者讓您的方法返回地圖:public Map<?, ?> getSettings()

然後#{myConfigBean.settings['autoStartup']}

+0

感謝@Gary的快速響應,如何在運行時刷新此配置? –

相關問題