在普通java中拆分包 [英] Split packages in plain java
问题描述
OSGi在拆分包时遇到问题,即同一个包但托管在多个包中。
OSGi has a problem with split packages, i.e. same package but hosted in multiple bundles.
是否有任何边缘情况,拆分包可能会在普通java中造成问题(没有OSGi)?
Are there any edge cases that split packages might pose problems in plain java (without OSGi) ?
好奇。
推荐答案
对于OSGi包在不同的bundle中,不管它们的名称如何都是不同的,因为每个bundle都使用自己的类加载器。确保封装包不是问题而是一个特性。
For OSGi packages in different bundles are different, regardless of their name, because each bundle uses its own class loader. It is not a problem but a feature, to ensure encapsulation of bundles.
所以在普通Java中这通常不是问题,直到你开始使用一些使用类的框架装载机。这通常是组件加载时的情况。
So in plain Java this is normally not a problem, until you start using some framework that uses class loaders. That is typically the case when components are loaded.
这篇关于在普通java中拆分包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!