O'Neil Tomlinson
O'Neil Tomlinson

Reputation: 898

Calling Java method via a Mule Java component

How do you specify the name of the function/method when calling a class using the Java component in Mule Anypoint-studio?

Upvotes: 1

Views: 1861

Answers (2)

sulthony h
sulthony h

Reputation: 1277

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>

Upvotes: 1

O&#39;Neil Tomlinson
O&#39;Neil Tomlinson

Reputation: 898

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"/>

Upvotes: 6

Related Questions