Java Module - Mule 4
Support Category: Select
Java Module v1.2
Mule 4 is built to:
Minimize the need for custom code.
Avoid the need for you to know or understand Java.
However, some advanced uses cases require integration with custom Java code, such as:
Reuse of a library, such as a tax calculation library.
Reuse of a canonical object model that is standard in the organization.
Execution of custom logic using Java.
In Mule 3, MEL served as a bridge for creating instances of Java classes and executing Java methods. In Mule 4, interoperation with Java changed, due to the replacement of MEL by DataWeave, which is a functional language. Functional languages do not have side effects on their input arguments, so it does not make sense for DataWeave to execute random instance methods on random object instances. Therefore, pure DataWeave supports calling only static Java methods, without use of the Java module.
<dependency> <groupId>org.mule.module</groupId> <artifactId>mule-java-module</artifactId> <version>RELEASE</version> <classifier>mule-plugin</classifier> </dependency>
Mule converts RELEASE to the latest version. To specify a version, view Java Module in Anypoint Exchange and click Dependency Snippets.