In theory you can have several benefits when using the same libraries sharing between applications:
Less memory usage , since there will be only one instance of each class, in the Classloader of shared libraries, instead of one for each application, in the particular Classloader created for each them.
Less bandwidth usage and deploy faster , because the packet gets much smaller. Java applications that I have seen have packages in the range of 50 to 100MB, but the application code itself is generally 10% of that size, the rest being composed only of third-party libraries.
Best performance , if you consider the greater cache usage the JVM and the operating system can do since the executed classes are the same.
>
However, there are also some disadvantages:
All applications need to be up to date to use the same versions of all APIs, which is often not feasible in a corporate environment.
Updating an API needs to be synchronized with updating all applications, which makes it very difficult to administer the servers.
Assembling the application WAR or EAR package must be careful because if an application contains the same dependencies as the shared lib, "dreaded" Classloader conflicts can occur, which generate bizarre and hard-to-identify errors.
Speaking more specifically about the problems of different classes in different Classloaders, this does not dignify that always problems will occur. But if there are two versions of the same library, Wildfly may occur to load the classes you do not want it to carry.
This happened a lot with me on Tomcat. The general rule is: the container will always load the incorrect version of the class!
Another approach that would give you a bit more flexibility is the use of modules . You could package each framework into a custom module and make your applications depend on those modules. This is an interesting alternative because it allows each application to use only the required libs and even different versions of the same framework.
Creating modules is a common technique for adding new database drivers, as described this link .