2016-09-26 37 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的快速响应,如何在运行时刷新此配置? –

相关问题