1

我正在使用 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 中定义的。我可以为每个应用程序定义一个特定的文件属性。

预先感谢您的任何帮助

4

1 回答 1

0

You could namespace your properties to prevent cross-sharing, like "readApp.prop.conn" and "writeApp.prop.conn".

Alternatively, try turning system properties off:

<spring:beans>
    <context:property-placeholder location="classpath:connections.properties"
        ignore-unresolvable="true" system-properties-mode="NEVER" />
</spring:beans>
于 2013-06-11T14:44:18.333 回答