Jetty如何处理具有不同依赖关系的同一个类的类加载? [英] How Jetty handles class loading with same class with different dependencies?
问题描述
我想知道当多个依赖路径可以导致同一个类时,码头如何处理.
I want to know how jetty handles when multiple dependency paths which can lead to same class.
例如,
Jetty预先与JSTL-1.2一起打包,但是我添加了一个依赖项来加载JSTL-1.2.4.在编译时,如果我断点测试它在eclipse中下载源代码,它会在1.2.4版本中中断.
Jetty comes pre-packaged with JSTL-1.2, but I added a dependency to load JSTL-1.2.4. At compile time, if I breakpoint test it downloading the source code in eclipse, it breaks at 1.2.4 version.
当有两个版本的类时,我想知道将传递哪个版本来生成JSP的字节码,比如说某些基类 JstlCoreTlv 依赖(一个预先包装的,即具有码头的JSTL 1.2和来自Maven依赖项1.2.4的JSTL)
I want to know which version will be passed to generate byte code of a JSP, when there are two versions of classes, say some base class JstlCoreTlv in dependency (one pre-packaged, that is JSTL 1.2 with jetty and one passed from maven dependency 1.2.4)
简而言之,我想知道码头是怎么做的.我想知道码头如何优先考虑预包装与以后添加的依赖关系.即使该版本比预先打包的版本旧,它也会覆盖并引用附加的依赖项吗?
In brief, I want to know How jetty is doing it. I want to know how jetty prioritizes pre-packaged vs dependencies added later. Even if the version is older than that of pre-packaged one, will it override and refer to added dependencies?
在这种情况下,我从码头文件中获得的信息不多.非常感谢您的帮助
I couldn't get much in this context from jetty documentation. Help is much appreciated
推荐答案
servlet规范要求:
The servlet specification require that:
- WEB-INF/lib或WEB-INF/class中包含的类的优先级高于父类加载器(此处是jetty的类加载器)上的类.