应用范围PropertyPlaceHolder Spring in Mule

时间:2013-06-10 09:26:42

标签: spring mule placeholder

我正在使用Mule CE 3.3.0,我对PropertyPlaceHolder的范围有疑问。假设我有两个mule应用程序(writeApp和readApp)。在writeApp应用程序中,我按如下定义设置了propertyPlaceholer bean:

<spring:bean id="consignmentProperty" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <spring:property name="ignoreUnresolvablePlaceholders" value="true"/>
        <spring:property name="locations">
            <spring:list>
                <spring:value>classpath:connections.properties</spring:value>
                    <spring:value>.....</spring:value>
            </spring:list>
        </spring:property>
</spring:bean>

在readApp应用程序中,我尝试读取writeApp

中定义的属性
<mule>
    <flow name="readContextVariableFlow1" doc:name="readContextVariableFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8085" path="read" doc:name="HTTP"/>
        <append-string-transformer message="${prop.conn}" doc:name="Append String"/>
        <object-to-string-transformer doc:name="Object to String"/>
    </flow>
</mule>

问题是,现在我能够从readApp读取prop.conn属性,尽管它是在writeApp中定义的。我可以为每个应用程序定义一个特定的文件属性。

提前感谢您提供任何帮助

1 个答案:

答案 0 :(得分:0)

您可以命名属性以阻止交叉共享,例如“readApp.prop.conn”和“writeApp.prop.conn”。

或者,尝试关闭系统属性:

<spring:beans>
    <context:property-placeholder location="classpath:connections.properties"
        ignore-unresolvable="true" system-properties-mode="NEVER" />
</spring:beans>