我定义了一个属性PFlow_XXXX="some value"
,使用camel属性占位符读取。在处理器内部,通过从文件名中提取xxx value
来构造属性值。现在,当我尝试在处理器内获取此属性的值时,就像这样
exchange.getContext().resolvePropertyPlaceholders("{{xsdPathVar}}"));
其中String xsdPathVar = "PFlow_"+extracting from file
。
但这不起作用。有人可以帮助我如何从字符串变量中读取属性值。
答案 0 :(得分:1)
使用propertyPlaceholder
时,您可以使用@PropertyInject
注释在bean中注入属性:
@PropertyInject(value = "xsdPathVar")
String xsdPathVar;
Public class MyProcessor implements Processor {
...
}
我不完全确定这是否是你所要求的?