我希望能够执行以下操作:
<spring:beans>
<spring:bean id="myBean" class="com.address.myClass"/>
</spring:beans>
<choice>
<when expression="myBean.myMethod() == true" evaluator="someEvaluator">
<!-- do some stuff -->
</when>
</choice>
如果“myBean.myMethod()”返回 true,我想调用“一些东西”。
这可以做到吗?
------更新------
大卫很友善地帮助我找到了这个可行的解决方案。由于它隐藏在下面的评论中,我在此处添加了解决方案:
<when expression="muleContext.getRegistry().lookupObject('myBean').myMethod()==true" evaluator="groovy">
最佳答案
在 Mule 3.3 中,使用 MEL:
<when expression="#[app.registry.myBean.myMethod()]">
对于较旧的 Mules,请使用 Groovy:
<when expression="muleContext.registry.lookupObject('myBean').myMethod()" evaluator="groovy">
关于java - 您可以从 MuleESB <choice> 调用 bean 中的方法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15418293/