Mule

"system-property" doesn't work with SpringConfigurationBuilder

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix or Usage Issue
  • Affects Version/s: 1.4.0
  • Fix Version/s: None
  • Labels:
    None
  • User impact:
    Low
  • Similar Issues:
    MULE-2150 Check System Properties in 2.0
    MULE-1233 SpringConfigurationBuilder: global endpoint do not work
    MULE-2751 SpringConfigurationBuilder does not preserve container contexts from a mule configuration
    MULE-661 Spring MuleEventMulticaster doesn't work
    MULE-1226 SpringConfigurationBuilder wrong translation of connector reference in Mule configuration file
    MULE-275 Sample errorhandler doesn't work
    MULE-5919 Reply-To doesn't work for WMQ transport
    MULE-5171 IMAP transport inbound endpoint doesn't work. Fails to retrieve email messages
    MULE-5683 cxf:jaxws-service mtomEnabled doesn't work
    MULE-640 JMS session caching doesn't work

Description

"system-property" (the one which lets you use an environment variable to set a property in your Mule config don't work with the SpringConfigurationBuilder.

To reproduce, use the SpringConfigurationBuilder to load the LoanBroker-ESB config. The following property from the config is no longer set to $MULE_HOME (and because of that the OpenEJB config is not located)

<system-property name="openejb.base" key="mule.home"/>

Issue Links

Activity

Hide
Daniel Feist added a comment - 25/Jul/07 02:55 PM

This is resolved by using spring's PropertyPlaceholderConfigurer

The PropertyPlaceholderConfigurer is generaly used with 1 or more property files. It can however be used on its without property files and will resolve system properties.

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

The placeholder _${mule.home}_ is then used where this value is needed.

Show
Daniel Feist added a comment - 25/Jul/07 02:55 PM This is resolved by using spring's PropertyPlaceholderConfigurer The PropertyPlaceholderConfigurer is generaly used with 1 or more property files. It can however be used on its without property files and will resolve system properties.
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
The placeholder _${mule.home}_ is then used where this value is needed.
Hide
Andrew Perepelytsya added a comment - 25/Jul/07 03:06 PM

Last time I checked there could be only one PropertyPlaceholderConfigurer per spring context (prop files separated via comma). How would a mix of system and file properties be resolved?

Show
Andrew Perepelytsya added a comment - 25/Jul/07 03:06 PM Last time I checked there could be only one PropertyPlaceholderConfigurer per spring context (prop files separated via comma). How would a mix of system and file properties be resolved?
Hide
andrew cooke added a comment - 25/Jul/07 05:05 PM

This was closed after the comment above. Was it resolved by email? A summary here would be useful. Thanks.

Show
andrew cooke added a comment - 25/Jul/07 05:05 PM This was closed after the comment above. Was it resolved by email? A summary here would be useful. Thanks.
Hide
Daniel Feist added a comment - 25/Jul/07 06:07 PM

This was resolved as part of MULE-1864

Solution Summary

You can have multiple PropertyPlaceholderConfigurer's per spring context and set their order/precedence to determine the order in which they are applied and each PropertyPlaceholderConfigurer can have 0-n property files ("locations") containing properties.

The PropertyPlaceholderConfigurer also provides system property functionality, with three modes modes of operation.

The default is "fallback" meaning that for any property that is not resolved by properties in property files the system property with that key will be used.

This functionality and the configuration in the comment above mean that the simple definition of a PropertyPlaceholderConfigurer with no locations will resolve system properties.

The solution config I gave above is not complete in that it does not use the intermediate "openejb.base" variable.. to do that you would do one of the following:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="properties">
        <props>
            <prop key="openejb.base">${mule.home}</prop>
        </props>
    </property>
</bean>

OR

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:openejb.properties</value>
        </list>
    </property>
</bean>

openejb.properties

openejb.base=${mule.home}

(It was marked as won't fix because this is not a bug that needs resolving, it can be resolved with through spring configuration)

Show
Daniel Feist added a comment - 25/Jul/07 06:07 PM This was resolved as part of MULE-1864 Solution Summary You can have multiple PropertyPlaceholderConfigurer's per spring context and set their order/precedence to determine the order in which they are applied and each PropertyPlaceholderConfigurer can have 0-n property files ("locations") containing properties. The PropertyPlaceholderConfigurer also provides system property functionality, with three modes modes of operation. The default is "fallback" meaning that for any property that is not resolved by properties in property files the system property with that key will be used. This functionality and the configuration in the comment above mean that the simple definition of a PropertyPlaceholderConfigurer with no locations will resolve system properties. The solution config I gave above is not complete in that it does not use the intermediate "openejb.base" variable.. to do that you would do one of the following:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="properties">
        <props>
            <prop key="openejb.base">${mule.home}</prop>
        </props>
    </property>
</bean>
OR
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:openejb.properties</value>
        </list>
    </property>
</bean>
openejb.properties
openejb.base=${mule.home}
(It was marked as won't fix because this is not a bug that needs resolving, it can be resolved with through spring configuration)
Hide
andrew cooke added a comment - 25/Jul/07 06:12 PM

Cool, thanks.

Show
andrew cooke added a comment - 25/Jul/07 06:12 PM Cool, thanks.

People

Vote (0)
Watch (1)

Dates

  • Created:
    13/Apr/07 12:24 PM
    Updated:
    11/Aug/07 03:13 PM
    Resolved:
    25/Jul/07 04:02 PM