我尝试在mule flow中使用全局属性:
<global-property name="SS_Out" value="${streamserve.dir.outbound}" doc:name="Global Property"/>
<global-property name="SI_In" value="${sendinvoice.dir.inbound}" doc:name="Global Property"/>
<global-property name="E2B_In" value="${streamserve.dir.e2boperational}" doc:name="Global Property"/>
在Java代码中获取和使用这些属性:
public Object onCall(MuleEventContext eventContext) throws Exception {
MuleMessage message = eventContext.getMessage();
MuleContext muleContext = eventContext.getMuleContext();
Object originalSSOutputFilePathProperty = muleContext.getRegistry().get("SS_Out");
Object originalSSInputFilePathProperty = muleContext.getRegistry().get("SI_In");
Object originalE2BInputFilePathProperty = muleContext.getRegistry().get("E2B_In");
但我有例外:
java.lang.IllegalArgumentException: Could not resolve placeholder 'streamserve.dir.outbound' in string
value "${streamserve.dir.outbound}"
请提前建议,谢谢
答案 0 :(得分:0)
无需在属性文件中定义Mule全局属性。属性持有者加载到mule的所有属性都是全局属性,可以直接访问。
${property.name}
请参阅以下stackoverflow答案。
Mule 3.3.0 - global property not being resolved from properties file