在Camel处理器内部,声明为从camel属性占位符保存属性的变量不起作用

时间:2017-10-13 06:44:32

标签: jboss apache-camel fuse

我定义了一个属性PFlow_XXXX="some value",使用camel属性占位符读取。在处理器内部,通过从文件名中提取xxx value来构造属性值。现在,当我尝试在处理器内获取此属性的值时,就像这样

exchange.getContext().resolvePropertyPlaceholders("{{xsdPathVar}}"));

其中String xsdPathVar = "PFlow_"+extracting from file

但这不起作用。有人可以帮助我如何从字符串变量中读取属性值。

1 个答案:

答案 0 :(得分:1)

使用propertyPlaceholder时,您可以使用@PropertyInject注释在bean中注入属性:

@PropertyInject(value = "xsdPathVar")
String xsdPathVar;

Public class MyProcessor implements Processor {
    ...
}

我不完全确定这是否是你所要求的?