感谢您的关注
我在项目中使用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>
最佳答案
使用SpEL
调用bean中的方法-#{myConfigBean.autoStartupSetting}
将调用getAutoStartupSetting()
。
或者让您的方法返回一个映射:public Map<?, ?> getSettings()
。
然后#{myConfigBean.settings['autoStartup']}
。