You're right that the lifecycle of the services registered through the ServiceLoader mechanism is not well defined. On the other hand, the AdditionalServiceLoader's javadoc is very clear that it's using the deployment classloaders, TCCL and Weld's classloader to discover the service providers. Another thing is that JpaInjectionServices should be a per-module service but AdditionalServiceLoader loads services globally, i.e. the instance is also copied to all BeanManager registries. This does not seem to be correct and should be documented at least. |