Daily Archives: July 28, 2011

mule with spring and testing without mule…

mule is able to import spring beans… as expected 🙂 but to test those… its kinda hard… 🙁

first create an own bean config file separated from the mule-config.xml and include it in mule-config.xml with following tags:

<spring:beans>
<spring:import resource=”beans.xml”/>
</spring:beans>

simple 🙂 now the beans.xml is a simple springbeans config file… with <beans> as root tag and <bean>’s inside. easy too…

and now use following annotation in the unittest:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={“classpath:beans.xml”})

this should now load the bean correctly during test…