Dav*_*vid 4 spring expression properties placeholder apache-camel
我想在驼峰路线中使用属性占位符.我有test.properties定义属性:MQ.queuename1 = TESTQUEUE.在camel上下文中,我定义了占位符:
<camel:camelContext xmlns="http://camel.apache.org/schema/spring" >
<propertyPlaceholder id="camel-properties" location="file:${web.external.propdir}/test.properties"/>
Run Code Online (Sandbox Code Playgroud)
在路线中,我使用简单的表达来评估属性:
<choice>
<when>
<simple>${in.header.queuename} == '{{MQ.queuename1}}'</simple>
<bean ref="ExtractOrderContent" method="extractContent"/>
<to uri="websphere-mq:queue:TESTQUEUE" pattern="InOnly"/>
</when>
</choice>
Run Code Online (Sandbox Code Playgroud)
当我运行camel时,属性文件被camel识别,但看起来简单的表达式不起作用.我什么都想念?
Cla*_*sen 13
您可以使用简单的属性函数(http://camel.apache.org/simple)
<simple>${in.header.queuename} == ${properties:MQ.queuename1}</simple>
Run Code Online (Sandbox Code Playgroud)
嵌套<when>中的{{}}可能是由于一个bug,已在较新的Camel版本中修复.