jakartaee / mail-api

Jakarta Mail Specification project
https://jakartaee.github.io/mail-api
Other
242 stars 100 forks source link

The hk2 service loader is not used everywhere (where necessary) #635

Closed mnlipp closed 1 year ago

mnlipp commented 1 year ago

Describe the bug

Currently, the hk2 service locator is used in FactoryFinder only. Session.java uses the ServiceLoader without the hk2 "wrapper" and therefore fails to load the providers in an OSGi environment.

jbescos commented 1 year ago

@mnlipp this was merged: https://github.com/jakartaee/mail-api/pull/633

Can we close this?

mnlipp commented 1 year ago

Can we close this?

No. #633 was about introducing the OSGi service mediator. Now, if you don't have this in place, the fallback is to use the hk2 service locator. Hk2 requires special coding for looking up the services. This special coding is currently only provided in FactoryFinder. It's missing in Session.java. Therefore providers are not found in an OSGi environment.