如图所示:
classpath对应的JVM中的类和jboss-home/lib目录下的类处于最底层,我们暂且称之为“低级”层;
deploy目录中应用中的类和server/xxx/lib中的类处于中间层,称之为“中级”层;
WAR包中的类处于最高级,称之为“高级”层;
jboss的类加载机制为高级层中的类可以应用中低级层中的类,中级层中的类可以引用低级层中的类,反之则不行。即处于上层中的类对于处于下层中的类是不可见的。
此种类加载机制可以让我们在发布的多个应用程序共享类包。但是也有其缺点:如果两个application需要同一个类包的不同版本,这种方式无法解决了。可以通过配置范围来解决。