How do I implement a project in which different modules load different versions of the jar package with the same name?
It was Ali's interview when he met a face test. At that time a bit dizzy, if it is usually encountered such a problem must be unified load the same version of the good.
It is really necessary to address such problems if the system is particularly large and relies heavily on conflict and involves multi-sectoral coordination.
The problem has plagued me for a long time and there has been no good solution. Recently studied Java virtual machines. Finally found the answer.
In the JVM, different Java types are distinguished by class name and ClassLoader. As a result, the JVM allows us to load Java classes of the same namespace with different loaders, while in fact these same namespace Java classes can be completely different classes.
Usually we use the default class loader, so a class with the same name or a jar package with the same name is unique and cannot load different versions of the jar package with the same name. The different loaders in the JVM are Java classes that can load the same namespace.
Java class loading mechanism-how to implement different modules in a project load different versions of the jar package with the same name.