简体   繁体   中英

Calling Java method via a Mule Java component

在Mule Anypoint-studio中使用Java组件调用类时,如何指定函数/方法的名称?

I found out you have to setup a bean by adding the following to your mule configuration xml file.

   <spring:beans>
        <spring:bean name="myBean" class="MyClass"/>
    </spring:beans>

then use the Invoke component where you can specify the bean and the function/method you wish to call

 <invoke name="aName" object-ref="myBean" method="raiseException" doc:name="Invoke"/>

If you are using Java Component, then you can try this directly into Configuration XML:

<component class="com.mulesoft.training.JavaWithMultipleMethods" doc:name="Java">
    <method-entry-point-resolver>
        <include-entry-point method="getMethod"/>
    </method-entry-point-resolver>
</component>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM