I have the following mule expression in a choice component:
<choice doc:name="Choice">
<when expression="'localhost' == ${environment}">
... Do something
</when>
The environment property is loaded via a property file, and appears to resolve correctly. However, I get the following error:
[Error: unresolvable property or identifier: localhost]
[Near : {... 'localhost' == localhost ....}]
I've also tried wrapping the expression in #[], and reversing the order of the variables in the comparison <when expression="${environment} == 'localhost'">
, but I get the same error.
The spring property is interpolated before the XML is parsed, leading to the following XML configuration when the environment property is equal to "localhost":
<choice doc:name="Choice">
<when expression="'localhost' == localhost">
... Do something
</when>
Mule will look for a flow variable or session variable named "localhost", which is probably not what you want.
Try this:
<choice doc:name="Choice">
<when expression="'localhost' == '${environment}'">
... Do something
</when>