如何在Spring集成中从数据库中读取配置适配器?

时间:2016-09-26 08:20:24

标签: java spring spring-integration

感谢您的关注 我在我的项目中使用Spring Integration,我想从数据库中读取自动启动,远程目录等配置,怎么做?
我的代码如下:

<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 个答案:

答案 0 :(得分:1)

使用SpEL调用bean中的方法 - #{myConfigBean.autoStartupSetting}将调用getAutoStartupSetting()

或让您的方法返回地图:public Map<?, ?> getSettings()

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