You can do this, but you will need to create and add a helper bean property helper that uses the BeanFactory to find the property value. After that, you can get this bean from the Mule context and use it to retrieve the property value.
PropertiesAccessor propertiesAccessor = muleContext.getRegistry().get("propertiesAccessor");
Assert.assertEquals("expectedvalue", propertiesAccessor.getProperty("key"));
PropertyAccessor bean , XML .
<?xml version="1.0" encoding="UTF-8"?>
<spring:beans xmlns:context="http://www.springframework.org/schema/context"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
">
<context:annotation-config />
<spring:bean id="propertiesAccessor" class="PropertiesAccessor" />
</spring:beans>
mule-config xml FunctionalTestCase
@Override
protected String[] getConfigFiles() {
return new String[] {
"src/main/app/mule-config.xml",
"src/test/resources/propertiesAccessor.xml",
};
}