I've encountered with a weird issue.
I have a mule configuration file. There is Nothing really exciting in it and works fine. At least it worked...
The problems started when I started to put the configuration parameters into several properties files. If I define a property in one file it gets resolved, but nothing from the other file.
No error message indicates that reading the file failed or anything...
My scenes tells me that this has something to do with the fact that the config files are read by org.mule.config.spring.SpringXmlConfigurationBuilder...
Did anyone had similar issue? or has anyone any idea what the heck is going on?
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:my-mule-app.properties</value>
<value>classpath:my-mule-app-override.properties</value>
</list>
</property>
</bean>
I'm not sure how you are configuring your context place holder but if you are using multiple properties you should declare a comma separated list of location like the following:
<context:property-placeholder
location="classpath:my-mule-app.properties,
classpath:my-mule-app-override.properties" />
If you need any further information you can find them in
the official documentation page on the topic
Thanks guys.
So the mysterious issue is solved. In my integration test I needed a started hornetq/mule server pair. For the test I wanted to inject all object that possible from usual spring XML configuration.
So I defined my MuleServer bean in spring XML config file and used the constructor that takes mule's config files as an array of String. What I wasn't aware of (or not thought through) that MuleServer class creates its own application context...
So in my tests application context I instantiated an object that creates its own application context...
Since Property placeholders are some sort of special beans and must be initialized before all other beans this caused the above weird behavior.
The solution was that I instantiated MuleServer with new keyword as in the old days in my tests setUp method.
That worked for me.