Invoke Custom Java Class using Dataweave

 

To Invoke Custom Java Class Using Dataweave, Let’s create a project in Anypoint studio.

Create Java Class in Anypoint studio

Invoke Custom Java Class Using Dataweave

 

Set the variable value

Invoke Custom Java Class Using Dataweave

 

Drag and drop Transform message and write code to invoke java class in Dataweave

Invoke Custom Java Class Using Dataweave

 

Dataweave

%dw 2.0
import java!company::TestSubstring

output application/json
---
{
	"a":TestSubstring::getSubString(vars.string)
}

Deploy the project and test

Invoke Custom Java Class Using Dataweave

 

Download sample project

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tejaswi
Tejaswi
3 months ago

Why did it give -> “a” : “Tendulkar” ? the variable string was of value “Sachin Tendulkar”