Mule 4 is built to:
Minimize the need for custom code.
Avoid the need for you to know or understand Java.
However, there are some advanced uses cases that require integration with custom Java code, for example:
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 changes, 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 only supports calling static Java methods, without use of the Java Module.