Spring XD:多个模块实例的单独配置

时间:2015-01-27 09:52:50

标签: spring spring-xd

My Spring XD流定义包含对同一自定义模块的引用,但具有不同的配置参数,例如

stream create --name mystream1 --definition "tcp --port=4444 | mycustommod --myprop='very long property value 1'" | log"
stream create --name mystream2 --definition "tcp --port=5555 | mycustommod --myprop='very long property value 2'" | log"

我可以将长模块配置放入外部模块配置文件中。但这仅适用于第一个模块实例。对于我在流定义中使用的其余模块实例,我必须直接覆盖流定义中的外部化配置。

如果要覆盖许多[或长]属性值,那会使流定义膨胀。

有没有办法将不同的模块实例配置放到外部配置文件中,以便保持流定义清晰?

1 个答案:

答案 0 :(得分:2)

您可以在模块配置中定义属性占位符,例如

<context:property-placeholder location="${xd.module.config.location}\processor\${xd.module.name}\${xd.stream.name}.properties"
     ignore-resource-not-found="true" local-override="true"/>

然后在你的情况下,你把你的财产放在

<module_config_location>\processor\mycustommod\mystream1.properties
<module_config_location>\processor\mycustommod\mystream2.properties   

相关问题