Uso de expresiones de mula en una configuración de primavera

I'm setting up a Mule application and in it, I wanted to use Spring beans to wire up an EHCache and JDBC connection. Instead of putting the configuration information in each Mule application I create, I wanted to use a properties file which would be located at $mule_home/conf.

I know how to use a Mule expression to access the Mule home directory(#[mule:context.homeDir]) but when I attempt to put that expression inside my context.xml file, which I link in my mule application configuration, and start up the server, I get a

java.io.FileNotFoundException: #[mule:context.homeDir]\conf\jdbc.properties (The system cannot find the path specified)

Even if I create a seperate property in the mule configuration, ${homeDir} que tiene un valor de #[mule:context.homeDir] it gives me the same error, except with ${homeDir} as being unable to resolve.

I've turned logging up and can see it wiring up the property ${homeDir}, but it seems the the property-placeholder does not want to resolve it. I've tried both and using a raw bean of the class of PropertyPlaceholderConfigurer:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>file:#[mule:context.homeDir]/conf/jdbc.properties</value>
            <value>file:#[mule:context.homeDir]/conf/standalone-ehcache.conf</value>
            <value>classpath:gateway.properties</value>
        </list>
    </property>
</bean>

preguntado el 30 de enero de 12 a las 19:01

1 Respuestas

${MULE_HOME}/conf is on Mule's classpath so the following should work:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="locations">
    <list>
        <value>classpath:jdbc.properties</value>
        <value>classpath:standalone-ehcache.conf</value>
        <value>classpath:gateway.properties</value>
    </list>
  </property>
</bean>

Respondido el 31 de enero de 12 a las 00:01

This works... I couldn't find any documentation for this, but you are right in that this works. Thank you very much. - Nicholas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.