Reputation: 45
A class is in fragment bundle.
Can this class override or extends host bundle for same name class?
Bundle-SymbolicName: example
Bundle-SymbolicName: example.fragment
Fragment-Host: example;
can anyone give me Some of Fragment bundle examples?
Thanks!
Upvotes: 3
Views: 1653
Reputation: 9384
Yes it is possible but only if the host bundle prepared itself by putting an element at the start of its Bundle-Classpath that a later fragment can populate.
Upvotes: 5
Reputation: 16142
No, it's explicitly stated in the OSGi specification that resources (including classfiles) will be first looked up in the host bundle, and only if not found there will any fragment bundles be consulted.
If you use Declarative Services you can override a service by redeclaring it in a fragment with a higher priority than the host.
Upvotes: 1